gcc/testsuite/g++.dg/parse/pr31952-1.C
raw| 1 | // PR c++/31952 |
| 2 | |
| 3 | int |
| 4 | f0 (int bar) // { dg-message "previously" } |
| 5 | try |
| 6 | { |
| 7 | return 0; |
| 8 | } |
| 9 | catch (...) |
| 10 | { |
| 11 | int bar = 0; // { dg-error "shadows a parameter" } |
| 12 | return 1; |
| 13 | } |
| 14 | |
| 15 | int |
| 16 | f1 (int bar) |
| 17 | try |
| 18 | { |
| 19 | return 0; |
| 20 | } |
| 21 | catch (...) |
| 22 | { |
| 23 | { |
| 24 | int bar = 0; // Ok, not outermost block. |
| 25 | } |
| 26 | return 1; |
| 27 | } |
| 28 | |
| 29 | int |
| 30 | f2 (int bar) |
| 31 | { |
| 32 | try |
| 33 | { |
| 34 | return 0; |
| 35 | } |
| 36 | catch (...) |
| 37 | { |
| 38 | int bar = 0; // Ok, not a function-try-block. |
| 39 | return 1; |
| 40 | } |
| 41 | } |