gcc/testsuite/g++.dg/eh/synth1.C
raw| 1 | // PR c++/6179 |
| 2 | |
| 3 | // Bug: we tried to look at the fields of 'const A' to determine the proper |
| 4 | // exception specification for the synthesized copy constructor, but |
| 5 | // TYPE_FIELDS hadn't been set yet, so we incorrectly got a throw() spec. |
| 6 | |
| 7 | struct B |
| 8 | { |
| 9 | B () {} |
| 10 | B (const B&) { throw 1; } |
| 11 | }; |
| 12 | |
| 13 | struct A; |
| 14 | void f (const A &) {} |
| 15 | struct A |
| 16 | { |
| 17 | B b; |
| 18 | }; |
| 19 | |
| 20 | int main () |
| 21 | { |
| 22 | A a; |
| 23 | try |
| 24 | { A a2 (a); } |
| 25 | catch (...) |
| 26 | { } |
| 27 | } |