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/config.hpp> |
9 | #ifdef BOOST_NO_CXX11_VARIADIC_MACROS |
10 | # error "variadic macros required" |
11 | #else |
12 | |
13 | #include <boost/local_function.hpp> |
14 | #include <boost/detail/lightweight_test.hpp> |
15 | |
16 | int main(void) { |
17 | //[nesting |
18 | int x = 0; |
19 | |
20 | void BOOST_LOCAL_FUNCTION(bind& x) { |
21 | void BOOST_LOCAL_FUNCTION(bind& x) { // Nested. |
22 | x++; |
23 | } BOOST_LOCAL_FUNCTION_NAME(g) |
24 | |
25 | x--; |
26 | g(); // Nested local function call. |
27 | } BOOST_LOCAL_FUNCTION_NAME(f) |
28 | |
29 | f(); |
30 | //] |
31 | |
32 | BOOST_TEST(x == 0); |
33 | return boost::report_errors(); |
34 | } |
35 | |
36 | #endif // VARIADIC_MACROS |
37 | |
38 |