p1.cpp revision 7acafd032e145dbdbbed9274ca57ec2c86b912bc
1// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s 2 3// Simple parser tests, dynamic specification. 4 5namespace dyn { 6 7 struct X { }; 8 9 struct Y { }; 10 11 void f() throw() { } 12 13 void g(int) throw(X) { } 14 15 void h() throw(X, Y) { } 16 17 class Class { 18 void foo() throw (X, Y) { } 19 }; 20 21 void (*fptr)() throw(); 22 23} 24 25// Simple parser tests, noexcept specification. 26 27namespace noex { 28 29 void f() noexcept { } 30 void g() noexcept (true) { } 31 void h() noexcept (false) { } 32 void i() noexcept (1 < 2) { } 33 34 class Class { 35 void foo() noexcept { } 36 void bar() noexcept (true) { } 37 }; 38 39 void (*fptr)() noexcept; 40 void (*gptr)() noexcept (true); 41 42} 43 44namespace bad { 45 46 void f() throw(int) noexcept { } // expected-error {{cannot have both}} 47 void g() noexcept throw(int) { } // expected-error {{cannot have both}} 48 49} 50