blob: 8deed35559ce4dfba6f2814db2b6b0762ecb4cad [file] [log] [blame]
Daniel Dunbarffd408a2009-03-24 02:24:46 +00001// RUN: clang-cc -fsyntax-only -verify %s
Sebastian Redlb12ac332008-12-21 16:41:36 +00002
3void f()
4{
5 try {
6 ;
7 } catch(int i) {
8 ;
9 } catch(...) {
10 }
11}
12
13void 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 Redlbc9ef252009-04-26 20:35:05 +000026
27void h() try {
28} catch(...) {
29}
30
31struct 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
43A::A(char) : i(0) try {} // expected-error {{expected '{' or ','}}
44A::A(int j) try : i(j) {} catch(...) {}