tu_test.hpp 1003 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. // Copyright (C) 2006-2009, 2012 Alexander Nasonov
  2. // Copyright (C) 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/scope_exit
  7. // No #include guard for this header.
  8. #include <boost/scope_exit.hpp>
  9. #include <boost/config.hpp>
  10. int tu1(void);
  11. int tu2(void);
  12. inline int inline_f(void) {
  13. int i = 99;
  14. {
  15. BOOST_SCOPE_EXIT( (&i) ) {
  16. i = -1;
  17. } BOOST_SCOPE_EXIT_END
  18. }
  19. return i;
  20. }
  21. #if !defined(BOOST_INTEL) && defined(__GNUC__) && \
  22. (__GNUC__ * 100 + __GNUC_MINOR__) >= 304
  23. template<class Int>
  24. Int template_f(Int i) {
  25. {
  26. BOOST_SCOPE_EXIT_TPL( (&i) ) {
  27. ++i;
  28. } BOOST_SCOPE_EXIT_END
  29. }
  30. return i;
  31. }
  32. #else
  33. inline int template_f(int i) {
  34. {
  35. BOOST_SCOPE_EXIT( (&i) ) {
  36. ++i;
  37. } BOOST_SCOPE_EXIT_END
  38. }
  39. return i;
  40. }
  41. #endif