Sebastian Redl | 4b07b29 | 2008-12-22 19:15:10 +0000 | [diff] [blame] | 1 | // RUN: clang -fsyntax-only -verify %s |
| 2 | |
Douglas Gregor | 4ec339f | 2009-01-19 19:26:10 +0000 | [diff] [blame] | 3 | struct A; // expected-note{{forward declaration of 'struct A'}} |
Sebastian Redl | 4b07b29 | 2008-12-22 19:15:10 +0000 | [diff] [blame] | 4 | |
| 5 | void 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 Redl | 8351da0 | 2008-12-22 21:35:02 +0000 | [diff] [blame] | 19 | |
| 20 | try { |
| 21 | } catch(...) { // expected-error {{catch-all handler must come last}} |
| 22 | } catch(int) { |
| 23 | } |
Sebastian Redl | 4b07b29 | 2008-12-22 19:15:10 +0000 | [diff] [blame] | 24 | } |