nesting_seq.cpp 659 B

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