diff options
Diffstat (limited to 'clang/test')
-rw-r--r-- | clang/test/CXX/except/except.spec/p1.cpp | 49 | ||||
-rw-r--r-- | clang/test/Parser/cxx-exception-spec.cpp | 17 |
2 files changed, 49 insertions, 17 deletions
diff --git a/clang/test/CXX/except/except.spec/p1.cpp b/clang/test/CXX/except/except.spec/p1.cpp new file mode 100644 index 00000000000..b2cec97d78c --- /dev/null +++ b/clang/test/CXX/except/except.spec/p1.cpp @@ -0,0 +1,49 @@ +// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s + +// Simple parser tests, dynamic specification. + +namespace dyn { + + struct X { }; + + struct Y { }; + + void f() throw() { } + + void g(int) throw(X) { } + + void h() throw(X, Y) { } + + class Class { + void foo() throw (X, Y) { } + }; + + void (*fptr)() throw(); + +} + +// Simple parser tests, noexcept specification. + +namespace noex { + + void f() noexcept { } + void g() noexcept (true) { } + void h() noexcept (false) { } + void i() noexcept (1 < 2) { } + + class Class { + void foo() noexcept { } + void bar() noexcept (true) { } + }; + + void (*fptr)() noexcept; + void (*gptr)() noexcept (true); + +} + +namespace bad { + + void f() throw(int) noexcept { } // expected-error {{cannot have both}} + void g() noexcept throw(int) { } // expected-error {{cannot have both}} + +} diff --git a/clang/test/Parser/cxx-exception-spec.cpp b/clang/test/Parser/cxx-exception-spec.cpp deleted file mode 100644 index e6c3c757f01..00000000000 --- a/clang/test/Parser/cxx-exception-spec.cpp +++ /dev/null @@ -1,17 +0,0 @@ -// RUN: %clang_cc1 -fsyntax-only %s - -struct X { }; - -struct Y { }; - -void f() throw() { } - -void g(int) throw(X) { } - -void h() throw(X, Y) { } - -class Class { - void foo() throw (X, Y) { } -}; - -void (*fptr)() throw(); |