gcc/testsuite/g++.dg/warn/Wexceptions1.C
raw| 1 | // PR c++/97675 |
| 2 | |
| 3 | // Explicit { dg-require-effective-target exceptions_enabled } to avoid verify compiler messages FAILs for '-fno-exceptions'. |
| 4 | |
| 5 | struct Base { }; |
| 6 | struct Child : Base { }; |
| 7 | int main() { |
| 8 | try { throw Child(); } |
| 9 | catch (Base const&) { } |
| 10 | catch (Child const&) { } // { dg-warning "exception of type .Child. will be caught by earlier handler" } |
| 11 | } |