1 // RUN: %clang_cc1 -fcxx-exceptions -fexceptions -fsyntax-only -verify %s 2 3 void f1() 4 { 5 try { 6 ; 7 } catch(int i) { 8 ; 9 } catch(...) { 10 } 11 } 12 13 void f2() 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 } 26 27 void f3() try { 28 } catch(...) { 29 } 30 31 struct A { 32 int i; 33 A(int); 34 A(char); 35 A() try : i(0) {} catch(...) {} 36 void f() try {} catch(...) {} 37 A(float) : i(0) try {} // expected-error {{expected '{' or ','}} 38 }; 39 40 A::A(char) : i(0) try {} // expected-error {{expected '{' or ','}} 41 A::A(int j) try : i(j) {} catch(...) {} 42 43 44 45 // PR5740 46 struct Type { }; 47 48 enum { Type } Kind; 49 void f4() { 50 int i = 0; 51 switch (Kind) { 52 case Type: i = 7; break; // no error. 53 } 54 } 55 56 // PR5500 57 void f5() { 58 asm volatile ("":: :"memory"); 59 asm volatile ("": ::"memory"); 60 } 61 62 int f6() { 63 int k, // expected-note {{change this ',' to a ';' to call 'f6'}} 64 f6(), // expected-error {{expected ';'}} expected-warning {{interpreted as a function declaration}} expected-note {{replace paren}} 65 int n = 0, // expected-error {{expected ';'}} 66 return f5(), // ok 67 int(n); 68 } 69