Debian Codegraph @

gcc/testsuite/g++.dg/eh/builtin9.C

raw
1 // PR c++/88482
2 // { dg-do compile }
3 // Explicit { dg-require-effective-target exceptions_enabled } to avoid verify compiler messages FAILs for '-fno-exceptions'.
4
5 extern "C" int __cxa_throw (void *, void *, void (*) (void *)); // { dg-message "previous declaration" }
6 extern "C" void *__cxa_get_exception_ptr (void *) throw ();
7 extern "C" double __cxa_begin_catch (void *) throw (); // { dg-message "previous declaration" }
8 extern "C" long *__cxa_end_catch () throw (); // { dg-message "previous declaration" }
9 extern "C" char __cxa_rethrow (); // { dg-message "previous declaration" }
10 extern "C" void __cxa_allocate_exception (__SIZE_TYPE__) throw ();// { dg-message "previous declaration" }
11 extern "C" void __cxa_free_exception (void *) throw ();
12
13 struct S { S (); S (const S &); ~S (); };
14
15 int
16 foo (int x)
17 {
18 if (x > 27)
19 throw 19; // { dg-error "conflicting" }
20 try
21 {
22 if (x > 15)
23 throw S ();
24 }
25 catch (S s) // { dg-error "conflicting" }
26 {
27 throw; // { dg-error "conflicting" }
28 }
29 return x + 3;
30 }