John McCall | 018591f | 2011-03-02 02:04:40 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -fsyntax-only -verify -fexceptions -fobjc-exceptions %s |
Andy Gibbs | 8e8fb3b | 2012-10-19 12:44:48 +0000 | [diff] [blame] | 2 | // expected-no-diagnostics |
John McCall | 811d0be | 2010-05-28 08:37:35 +0000 | [diff] [blame] | 3 | |
John McCall | 018591f | 2011-03-02 02:04:40 +0000 | [diff] [blame] | 4 | // Note that we're specifically excluding -fcxx-exceptions in the command line above. |
| 5 | |
| 6 | // That this should work even with -fobjc-exceptions is PR9358 |
John McCall | 811d0be | 2010-05-28 08:37:35 +0000 | [diff] [blame] | 7 | |
| 8 | // PR7243: redeclarations |
| 9 | namespace test0 { |
| 10 | void foo() throw(int); |
| 11 | void foo() throw(); |
| 12 | } |
| 13 | |
| 14 | // Overrides. |
| 15 | namespace test1 { |
| 16 | struct A { |
| 17 | virtual void foo() throw(); |
| 18 | }; |
| 19 | |
| 20 | struct B : A { |
| 21 | virtual void foo() throw(int); |
| 22 | }; |
| 23 | } |
| 24 | |
| 25 | // Calls from less permissive contexts. We don't actually do this |
| 26 | // check, but if we did it should also be disabled under |
| 27 | // -fno-exceptions. |
| 28 | namespace test2 { |
| 29 | void foo() throw(int); |
| 30 | void bar() throw() { |
| 31 | foo(); |
| 32 | } |
| 33 | } |
| 34 | |