Daniel Dunbar | ffd408a | 2009-03-24 02:24:46 +0000 | [diff] [blame] | 1 | // RUN: clang-cc -fsyntax-only -verify %s |
Sebastian Redl | b12ac33 | 2008-12-21 16:41:36 +0000 | [diff] [blame] | 2 | |
| 3 | void f() |
| 4 | { |
| 5 | try { |
| 6 | ; |
| 7 | } catch(int i) { |
| 8 | ; |
| 9 | } catch(...) { |
| 10 | } |
| 11 | } |
| 12 | |
| 13 | void g() |
| 14 | { |
| 15 | try; // expected-error {{expected '{'}} |
| 16 | |
| 17 | try {} |
| 18 | catch; // expected-error {{expected '('}} |
| 19 | |
| 20 | try {} |
| 21 | catch (...); // expected-error {{expected '{'}} |
| 22 | |
| 23 | try {} |
| 24 | catch {} // expected-error {{expected '('}} |
| 25 | } |
Sebastian Redl | bc9ef25 | 2009-04-26 20:35:05 +0000 | [diff] [blame^] | 26 | |
| 27 | void h() try { |
| 28 | } catch(...) { |
| 29 | } |
| 30 | |
| 31 | struct A { |
| 32 | int i; |
| 33 | A(float) : i(0) try {} // expected-error {{expected '{' or ','}} |
| 34 | A(int); |
| 35 | A(char); |
| 36 | // FIXME: There's something very strange going on here. After the first |
| 37 | // inline function-try-block, subsequent inline bodies aren't parsed anymore. |
| 38 | // Valgrind is silent, though, and I can't even debug this properly. |
| 39 | A() try : i(0) {} catch(...) {} |
| 40 | void f() try {} catch(...) {} |
| 41 | }; |
| 42 | |
| 43 | A::A(char) : i(0) try {} // expected-error {{expected '{' or ','}} |
| 44 | A::A(int j) try : i(j) {} catch(...) {} |