summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaCXX/exception-spec.cpp
diff options
context:
space:
mode:
authorSebastian Redl <sebastian.redl@getdesigned.at>2009-05-29 15:01:05 +0000
committerSebastian Redl <sebastian.redl@getdesigned.at>2009-05-29 15:01:05 +0000
commit10b9de45c3765363434641716540721fe966d512 (patch)
tree85ced9c16c5b238791acd040b0ae85ca8db4dbd4 /clang/test/SemaCXX/exception-spec.cpp
parent82dbbd7054c17289a13b2755b1f3fd1b4190e39d (diff)
downloadbcm5719-llvm-10b9de45c3765363434641716540721fe966d512.tar.gz
bcm5719-llvm-10b9de45c3765363434641716540721fe966d512.zip
Disallow exception specifications on multi-level indirections.
llvm-svn: 72571
Diffstat (limited to 'clang/test/SemaCXX/exception-spec.cpp')
-rw-r--r--clang/test/SemaCXX/exception-spec.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/clang/test/SemaCXX/exception-spec.cpp b/clang/test/SemaCXX/exception-spec.cpp
new file mode 100644
index 00000000000..d697e023554
--- /dev/null
+++ b/clang/test/SemaCXX/exception-spec.cpp
@@ -0,0 +1,25 @@
+// RUN: clang-cc -fsyntax-only -verify %s
+
+// Straight from the standard:
+// Plain function with spec
+void f() throw(int);
+// Pointer to function with spec
+void (*fp)() throw (int);
+// Function taking reference to function with spec
+void g(void pfa() throw(int));
+// Typedef for pointer to function with spec
+typedef int (*pf)() throw(int); // xpected-error spec-on-typedef
+
+// Some more:
+// Function returning function with spec
+void (*h())() throw(int);
+// Ultimate parser thrill: function with spec returning function with spec and
+// taking pointer to function with spec.
+// The actual function throws int, the return type double, the argument float.
+void (*i() throw(int))(void (*)() throw(float)) throw(double);
+// Pointer to pointer to function taking function with spec
+void (**k)(void pfa() throw(int)); // no-error
+// Pointer to pointer to function with spec
+void (**j)() throw(int); // expected-error {{not allowed beyond a single}}
+// Pointer to function returning pointer to pointer to function with spec
+void (**(*h())())() throw(int); // expected-error {{not allowed beyond a single}}
OpenPOWER on IntegriCloud