| 1 | // RUN: %clang_cc1 -fexceptions -fcxx-exceptions -fsyntax-only -verify %s |
| 2 | |
| 3 | // Dynamic specifications: valid types. |
| 4 | |
| 5 | struct Incomplete; // expected-note 3 {{forward declaration}} |
| 6 | |
| 7 | // Exception spec must not have incomplete types, or pointers to them, except |
| 8 | // void. |
| 9 | void ic1() throw(void); // expected-error {{incomplete type 'void' is not allowed in exception specification}} |
| 10 | void ic2() throw(Incomplete); // expected-error {{incomplete type 'Incomplete' is not allowed in exception specification}} |
| 11 | void ic3() throw(void*); |
| 12 | void ic4() throw(Incomplete*); // expected-error {{pointer to incomplete type 'Incomplete' is not allowed in exception specification}} |
| 13 | void ic5() throw(Incomplete&); // expected-error {{reference to incomplete type 'Incomplete' is not allowed in exception specification}} |
| 14 | |
| 15 | // Don't suppress errors in template instantiation. |
| 16 | template <typename T> struct TEx; // expected-note {{template is declared here}} |
| 17 | |
| 18 | void tf() throw(TEx<int>); // expected-error {{implicit instantiation of undefined template}} |
| 19 | |
| 20 | // DR 437, class throws itself. |
| 21 | struct DR437 { |
| 22 | void f() throw(DR437); |
| 23 | void g() throw(DR437*); |
| 24 | void h() throw(DR437&); |
| 25 | }; |
| 26 | |
| 27 | // DR 437 within a nested class |
| 28 | struct DR437_out { |
| 29 | struct DR437_in { |
| 30 | void f() throw(DR437_out); |
| 31 | void g() throw(DR437_out*); |
| 32 | void h() throw(DR437_out&); |
| 33 | }; |
| 34 | }; |
| 35 | |