Debian Codegraph @

libstdc++-v3/testsuite/18_support/105387_memptr.cc

raw
1 #include <testsuite_hooks.h>
2
3 // Test related to PR libstdc++/105387
4 // Check that pointer-to-member type exceptions can still be caught with -frtti.
5 // { dg-require-effective-target rtti }
6
7 void test_catch_ptr_to_member()
8 {
9 bool exception_thrown = false;
10 struct X { int i; };
11 try {
12 throw &X::i;
13 }
14 catch (const int X::*) {
15 exception_thrown = true;
16 }
17
18 VERIFY(exception_thrown);
19 }
20
21 int main()
22 {
23 test_catch_ptr_to_member();
24 return 0;
25 }