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