summaryrefslogtreecommitdiff
path: root/libs/scope_exit/test/tu_test.hpp
blob: 25b9a1c6a7e673fdac094b7df5aedf7e98db61e1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48

// Copyright (C) 2006-2009, 2012 Alexander Nasonov
// Copyright (C) 2012 Lorenzo Caminiti
// Distributed under the Boost Software License, Version 1.0
// (see accompanying file LICENSE_1_0.txt or a copy at
// http://www.boost.org/LICENSE_1_0.txt)
// Home at http://www.boost.org/libs/scope_exit

// No #include guard for this header.

#include <boost/scope_exit.hpp>
#include <boost/config.hpp>

int tu1(void);
int tu2(void);

inline int inline_f(void) {
    int i = 99;
    {
        BOOST_SCOPE_EXIT( (&i) ) {
            i = -1;
        } BOOST_SCOPE_EXIT_END
    }
    return i;
}

#if !defined(BOOST_INTEL) && defined(__GNUC__) && \
        (__GNUC__ * 100 + __GNUC_MINOR__) >= 304
template<class Int>
Int template_f(Int i) {
    {
        BOOST_SCOPE_EXIT_TPL( (&i) ) {
            ++i;
        } BOOST_SCOPE_EXIT_END
    }
    return i;
}
#else
inline int template_f(int i) {
    {
        BOOST_SCOPE_EXIT( (&i) ) {
            ++i;
        } BOOST_SCOPE_EXIT_END
    }
    return i;
}
#endif