xref: /aosp_15_r20/external/clang/test/SemaCXX/exception-spec-no-exceptions.cpp (revision 67e74705e28f6214e480b399dd47ea732279e315)
1*67e74705SXin Li // RUN: %clang_cc1 -fsyntax-only -verify -fexceptions -fobjc-exceptions %s
2*67e74705SXin Li // expected-no-diagnostics
3*67e74705SXin Li 
4*67e74705SXin Li // Note that we're specifically excluding -fcxx-exceptions in the command line above.
5*67e74705SXin Li 
6*67e74705SXin Li // That this should work even with -fobjc-exceptions is PR9358
7*67e74705SXin Li 
8*67e74705SXin Li // PR7243: redeclarations
9*67e74705SXin Li namespace test0 {
10*67e74705SXin Li   void foo() throw(int);
11*67e74705SXin Li   void foo() throw();
12*67e74705SXin Li }
13*67e74705SXin Li 
14*67e74705SXin Li // Overrides.
15*67e74705SXin Li namespace test1 {
16*67e74705SXin Li   struct A {
17*67e74705SXin Li     virtual void foo() throw();
18*67e74705SXin Li   };
19*67e74705SXin Li 
20*67e74705SXin Li   struct B : A {
21*67e74705SXin Li     virtual void foo() throw(int);
22*67e74705SXin Li   };
23*67e74705SXin Li }
24*67e74705SXin Li 
25*67e74705SXin Li // Calls from less permissive contexts.  We don't actually do this
26*67e74705SXin Li // check, but if we did it should also be disabled under
27*67e74705SXin Li // -fno-exceptions.
28*67e74705SXin Li namespace test2 {
29*67e74705SXin Li   void foo() throw(int);
bar()30*67e74705SXin Li   void bar() throw() {
31*67e74705SXin Li     foo();
32*67e74705SXin Li   }
33*67e74705SXin Li }
34*67e74705SXin Li 
35