1 
2 // Copyright (C) 2009-2012 Lorenzo Caminiti
3 // Distributed under the Boost Software License, Version 1.0
4 // (see accompanying file LICENSE_1_0.txt or a copy at
5 // http://www.boost.org/LICENSE_1_0.txt)
6 // Home at http://www.boost.org/libs/local_function
7 
8 #include <boost/local_function.hpp>
9 #include <boost/detail/lightweight_test.hpp>
10 
main(void)11 int main(void) {
12     int x = 0;
13 
14     void BOOST_LOCAL_FUNCTION( (bind& x) ) {
15         void BOOST_LOCAL_FUNCTION( (bind& x) ) {
16             x++;
17         } BOOST_LOCAL_FUNCTION_NAME(g)
18 
19         x--;
20         g();
21     } BOOST_LOCAL_FUNCTION_NAME(f)
22 
23     f();
24 
25     BOOST_TEST(x == 0);
26     return boost::report_errors();
27 }
28 
29