Ne.app NeANT
The Ne.app NeANT User module of the NeANT distribution.
FUNCTION_TRY_BLOCK.cpp
Go to the documentation of this file.
1// checking function-try-block
2
3
27
28template <class T>
30 try { // <-- testing
31 ++tried;
32 throw t;
33 }
34 catch (T) {
35 ++caught;
36 throw;
37 }
38
39
40struct S
41{
42 S (int i)
43 try // <-- testing
44 : i_ (i) {
45 ++tried;
46 foo (i_);
47 }
48 catch (int) {
49 ++caught;
50 throw;
51 }
52
53 int i_;
54};
55
56
57int main ()
58{
59 int result = 0;
60
61 try {
62 S s (123);
63
64 (void)&s;
65
66 result |= 1;
67 }
68 catch (int i) {
69 if (i != 123)
70 result |= 2;
71
72 if (tried != 2)
73 result |= 4;
74
75 if (caught != 2)
76 result |= 8;
77 }
78 catch (...) {
79 result |= 0x10;
80 }
81
82 return result;
83}
#define i
Definition 17.names.cpp:126
#define T
Definition 17.names.cpp:163
#define t
Definition 17.names.cpp:136
#define i_
Definition 17.names.cpp:180
#define s
volatile int result
int caught
int tried
int main()
#define foo(buf, s,...)