blob: 535f40d7805720a3cf7cb2b9276e58398c7b20e8 [file] [log] [blame]
Daniel Dunbard7d5f022009-03-24 02:24:46 +00001// RUN: clang-cc -fsyntax-only -verify %s
Sebastian Redla0fd8652008-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 Redld3a413d2009-04-26 20:35:05 +000026
27void h() try {
28} catch(...) {
29}
30
31struct A {
32 int i;
Sebastian Redld3a413d2009-04-26 20:35:05 +000033 A(int);
34 A(char);
Sebastian Redld3a413d2009-04-26 20:35:05 +000035 A() try : i(0) {} catch(...) {}
36 void f() try {} catch(...) {}
Sebastian Redlde1b60a2009-04-26 21:08:36 +000037 A(float) : i(0) try {} // expected-error {{expected '{' or ','}}
Sebastian Redld3a413d2009-04-26 20:35:05 +000038};
39
40A::A(char) : i(0) try {} // expected-error {{expected '{' or ','}}
41A::A(int j) try : i(j) {} catch(...) {}