gcc/testsuite/g++.dg/template/fntry1.C
raw| 1 | // PR c++/26433 |
| 2 | // { dg-do link } |
| 3 | |
| 4 | int get_int() |
| 5 | { |
| 6 | throw 1; |
| 7 | |
| 8 | return 0; |
| 9 | } |
| 10 | |
| 11 | template <class _T> class Test |
| 12 | { |
| 13 | public: |
| 14 | Test() |
| 15 | try |
| 16 | : i(get_int()) |
| 17 | { |
| 18 | i++; |
| 19 | } |
| 20 | catch(...) |
| 21 | { |
| 22 | // Syntax error caused by undefined __FUNCTION__. |
| 23 | const char* ptr = __FUNCTION__; |
| 24 | } |
| 25 | |
| 26 | private: |
| 27 | int i; |
| 28 | _T t; |
| 29 | }; |
| 30 | |
| 31 | int main() |
| 32 | { |
| 33 | try |
| 34 | { |
| 35 | Test<int> test; |
| 36 | } |
| 37 | catch(...) |
| 38 | { |
| 39 | return 1; |
| 40 | } |
| 41 | |
| 42 | return 0; |
| 43 | } |