aboutsummaryrefslogtreecommitdiff
path: root/test/SemaObjC/scope-check-try-catch.m
blob: fbec2543829224ac7244ac12e5a40a77c8f678fe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// RUN: clang-cc -fsyntax-only -verify %s

@class A, B, C;

void test1() {
  goto L; // expected-error{{illegal goto into protected scope}}
  goto L2; // expected-error{{illegal goto into protected scope}}
  goto L3; // expected-error{{illegal goto into protected scope}}
  @try {   // expected-note 3 {{scope created by @try block}}
L: ;
  } @catch (A *x) {
L2: ;
  } @catch (B *x) {
  } @catch (C *c) {
  } @finally {
L3: ;
  }
}

void test2(int a) {
  if (a) goto L0;
  @try {} @finally {}
 L0:
  return;
}

// rdar://6803963
void test3() {
  @try {
    goto blargh;
  blargh: ;
  } @catch (...) {}
}