1 2 // Copyright (C) 2006-2009, 2012 Alexander Nasonov 3 // Copyright (C) 2012 Lorenzo Caminiti 4 // Distributed under the Boost Software License, Version 1.0 5 // (see accompanying file LICENSE_1_0.txt or a copy at 6 // http://www.boost.org/LICENSE_1_0.txt) 7 // Home at http://www.boost.org/libs/scope_exit 8 9 // No #include guard for this header. 10 11 #include <boost/scope_exit.hpp> 12 #include <boost/config.hpp> 13 14 int tu1(void); 15 int tu2(void); 16 inline_f(void)17inline int inline_f(void) { 18 int i = 99; 19 { 20 BOOST_SCOPE_EXIT( (&i) ) { 21 i = -1; 22 } BOOST_SCOPE_EXIT_END 23 } 24 return i; 25 } 26 27 #if !defined(BOOST_INTEL) && defined(__GNUC__) && \ 28 (__GNUC__ * 100 + __GNUC_MINOR__) >= 304 29 template<class Int> template_f(Int i)30Int template_f(Int i) { 31 { 32 BOOST_SCOPE_EXIT_TPL( (&i) ) { 33 ++i; 34 } BOOST_SCOPE_EXIT_END 35 } 36 return i; 37 } 38 #else template_f(int i)39inline int template_f(int i) { 40 { 41 BOOST_SCOPE_EXIT( (&i) ) { 42 ++i; 43 } BOOST_SCOPE_EXIT_END 44 } 45 return i; 46 } 47 #endif 48 49