blob: fbec2543829224ac7244ac12e5a40a77c8f678fe [file] [log] [blame]
Steve Naroff7e3ec6d2009-04-14 20:53:38 +00001// RUN: clang-cc -fsyntax-only -verify %s
2
3@class A, B, C;
4
Chris Lattnere44e5cc2009-04-18 09:36:27 +00005void 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 Naroff7e3ec6d2009-04-14 20:53:38 +000010L: ;
11 } @catch (A *x) {
12L2: ;
13 } @catch (B *x) {
14 } @catch (C *c) {
15 } @finally {
16L3: ;
17 }
18}
Steve Naroff74511702009-04-15 14:38:36 +000019
Chris Lattnere44e5cc2009-04-18 09:36:27 +000020void test2(int a) {
Steve Naroff74511702009-04-15 14:38:36 +000021 if (a) goto L0;
22 @try {} @finally {}
23 L0:
24 return;
25}
Chris Lattnere44e5cc2009-04-18 09:36:27 +000026
27// rdar://6803963
28void test3() {
29 @try {
30 goto blargh;
31 blargh: ;
32 } @catch (...) {}
33}