[lld][WebAssembly] Reinstate mistakenly disabled test. NFC
[llvm-project.git] / clang / test / Parser / cxx-stmt.cpp
blobc2fa0a4df0df0e141ec020c5913f83eca0edec80
1 // RUN: %clang_cc1 -fcxx-exceptions -fexceptions -fsyntax-only -verify %s
3 void f1()
5 try {
7 } catch(int i) {
9 } catch(...) {
13 void f2()
15 try; // expected-error {{expected '{'}}
17 try {}
18 catch; // expected-error {{expected '('}}
20 try {}
21 catch (...); // expected-error {{expected '{'}}
23 try {}
24 catch {} // expected-error {{expected '('}}
27 void f3() try {
28 } catch(...) {
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 ','}}
40 A::A(char) : i(0) try {} // expected-error {{expected '{' or ','}}
41 A::A(int j) try : i(j) {} catch(...) {}
45 // PR5740
46 struct Type { };
48 enum { Type } Kind;
49 void f4() {
50 int i = 0;
51 switch (Kind) {
52 case Type: i = 7; break; // no error.
56 // PR5500
57 void f5() {
58 asm volatile ("":: :"memory");
59 asm volatile ("": ::"memory");
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);