gcc/testsuite/gdc.test/compilable/testgotoskips.d
raw| 1 | /* |
| 2 | Tests to defend against false positives from the goto skips over decl errors |
| 3 | */ |
| 4 | // https://issues.dlang.org/show_bug.cgi?id=23271 |
| 5 | class A { |
| 6 | private static A[] active; |
| 7 | private void test() { |
| 8 | foreach(a; active) { |
| 9 | if(a is this) |
| 10 | goto label; |
| 11 | } |
| 12 | // used to say Error: `goto` skips declaration of variable `s.A.test.__appendtmp4` at s.d(...) |
| 13 | active ~= this; |
| 14 | label: |
| 15 | return; |
| 16 | } |
| 17 | } |