Debian Codegraph @

gcc/testsuite/g++.dg/eh/builtin10.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" void __cxa_throw (void *, void *, void (*) (void *));
6 extern "C" float __cxa_get_exception_ptr (void *) throw (); // { dg-message "previous declaration" }
7 extern "C" void *__cxa_begin_catch (void *) throw ();
8 extern "C" void __cxa_end_catch ();
9 extern "C" void __cxa_rethrow ();
10 extern "C" void *__cxa_allocate_exception (__SIZE_TYPE__) throw ();
11 extern "C" int __cxa_free_exception (void *) throw (); // { dg-message "previous declaration" }
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;
28 }
29 return x + 3;
30 }