Steve Naroff | 7e3ec6d | 2009-04-14 20:53:38 +0000 | [diff] [blame] | 1 | // RUN: clang-cc -fsyntax-only -verify %s |
| 2 | |
| 3 | @class A, B, C; |
| 4 | |
Chris Lattner | e44e5cc | 2009-04-18 09:36:27 +0000 | [diff] [blame^] | 5 | void test1() { |
| 6 | goto L; // expected-error{{illegal goto into protected scope}} |
| 7 | goto L2; // expected-error{{illegal goto into protected scope}} |
| 8 | goto L3; // expected-error{{illegal goto into protected scope}} |
| 9 | @try { // expected-note 3 {{scope created by @try block}} |
Steve Naroff | 7e3ec6d | 2009-04-14 20:53:38 +0000 | [diff] [blame] | 10 | L: ; |
| 11 | } @catch (A *x) { |
| 12 | L2: ; |
| 13 | } @catch (B *x) { |
| 14 | } @catch (C *c) { |
| 15 | } @finally { |
| 16 | L3: ; |
| 17 | } |
| 18 | } |
Steve Naroff | 7451170 | 2009-04-15 14:38:36 +0000 | [diff] [blame] | 19 | |
Chris Lattner | e44e5cc | 2009-04-18 09:36:27 +0000 | [diff] [blame^] | 20 | void test2(int a) { |
Steve Naroff | 7451170 | 2009-04-15 14:38:36 +0000 | [diff] [blame] | 21 | if (a) goto L0; |
| 22 | @try {} @finally {} |
| 23 | L0: |
| 24 | return; |
| 25 | } |
Chris Lattner | e44e5cc | 2009-04-18 09:36:27 +0000 | [diff] [blame^] | 26 | |
| 27 | // rdar://6803963 |
| 28 | void test3() { |
| 29 | @try { |
| 30 | goto blargh; |
| 31 | blargh: ; |
| 32 | } @catch (...) {} |
| 33 | } |