1 // RUN: clang-cc -fsyntax-only -verify %s
3 struct A
; // expected-note 4 {{forward declaration of 'struct A'}}
5 struct Abstract
{ virtual void f() = 0; }; // expected-note {{pure virtual function 'f'}}
9 } catch(int i
) { // expected-note {{previous definition}}
11 int i
; // expected-error {{redefinition of 'i'}}
13 } catch(void v
) { // expected-error {{cannot catch incomplete type 'void'}}
14 } catch(A a
) { // expected-error {{cannot catch incomplete type 'struct A'}}
15 } catch(A
*a
) { // expected-error {{cannot catch pointer to incomplete type 'struct A'}}
16 } catch(A
&a
) { // expected-error {{cannot catch reference to incomplete type 'struct A'}}
17 } catch(Abstract
) { // expected-error {{variable type 'Abstract' is an abstract class}}
19 int j
= i
; // expected-error {{use of undeclared identifier 'i'}}
23 } catch(...) { // expected-error {{catch-all handler must come last}}
31 throw throw; // expected-error {{cannot throw object of incomplete type 'void'}}
32 throw (A
*)0; // expected-error {{cannot throw pointer to object of incomplete type 'struct A'}}
38 goto l4
; // expected-error {{illegal goto into protected scope}}
39 goto l3
; // expected-error {{illegal goto into protected scope}}
40 goto l2
; // expected-error {{illegal goto into protected scope}}
42 try { // expected-note 4 {{jump bypasses initialization of try block}}
45 goto l4
; // expected-error {{illegal goto into protected scope}}
46 goto l3
; // expected-error {{illegal goto into protected scope}}
49 } catch(int) { // expected-note 4 {{jump bypasses initialization of catch block}}
52 goto l4
; // expected-error {{illegal goto into protected scope}}
54 goto l2
; // expected-error {{illegal goto into protected scope}}
56 } catch(...) { // expected-note 4 {{jump bypasses initialization of catch block}}
60 goto l3
; // expected-error {{illegal goto into protected scope}}
61 goto l2
; // expected-error {{illegal goto into protected scope}}
66 goto l4
; // expected-error {{illegal goto into protected scope}}
67 goto l3
; // expected-error {{illegal goto into protected scope}}
68 goto l2
; // expected-error {{illegal goto into protected scope}}
80 return; // expected-error {{return in the catch of a function try block of a constructor is illegal}}
87 BadReturn::BadReturn(int) try {
92 return; // expected-error {{return in the catch of a function try block of a constructor is illegal}}
96 return; // expected-error {{return in the catch of a function try block of a constructor is illegal}}