blob: 0d72f119df7006421febe396961e4257c90e23b6 [file] [log] [blame]
Sebastian Redl4b07b292008-12-22 19:15:10 +00001// RUN: clang -fsyntax-only -verify %s
2
Douglas Gregor4ec339f2009-01-19 19:26:10 +00003struct A; // expected-note{{forward declaration of 'struct A'}}
Sebastian Redl4b07b292008-12-22 19:15:10 +00004
5void f()
6{
7 try {
8 } catch(int i) { // expected-note {{previous definition}}
9 int j = i;
10 int i; // expected-error {{redefinition of 'i'}}
11 } catch(float i) {
12 } catch(void v) { // expected-error {{cannot catch incomplete type 'void'}}
13 } catch(A a) { // expected-error {{cannot catch incomplete type 'struct A'}}
14 } catch(A *a) { // expected-error {{cannot catch pointer to incomplete type 'struct A'}}
15 } catch(A &a) { // expected-error {{cannot catch reference to incomplete type 'struct A'}}
16 } catch(...) {
17 int j = i; // expected-error {{use of undeclared identifier 'i'}}
18 }
Sebastian Redl8351da02008-12-22 21:35:02 +000019
20 try {
21 } catch(...) { // expected-error {{catch-all handler must come last}}
22 } catch(int) {
23 }
Sebastian Redl4b07b292008-12-22 19:15:10 +000024}