summaryrefslogtreecommitdiffstats
path: root/clang/test/CXX/except/except.spec/p1.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/test/CXX/except/except.spec/p1.cpp')
-rw-r--r--clang/test/CXX/except/except.spec/p1.cpp49
1 files changed, 49 insertions, 0 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}}
+
+}
OpenPOWER on IntegriCloud