diff options
author | ed <ed@FreeBSD.org> | 2009-06-02 17:58:47 +0000 |
---|---|---|
committer | ed <ed@FreeBSD.org> | 2009-06-02 17:58:47 +0000 |
commit | f27e5a09a0d815b8a4814152954ff87dadfdefc0 (patch) | |
tree | ce7d964cbb5e39695b71481698f10cb099c23d4a /test/SemaCXX/exception-spec.cpp | |
download | FreeBSD-src-f27e5a09a0d815b8a4814152954ff87dadfdefc0.zip FreeBSD-src-f27e5a09a0d815b8a4814152954ff87dadfdefc0.tar.gz |
Import Clang, at r72732.
Diffstat (limited to 'test/SemaCXX/exception-spec.cpp')
-rw-r--r-- | test/SemaCXX/exception-spec.cpp | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/test/SemaCXX/exception-spec.cpp b/test/SemaCXX/exception-spec.cpp new file mode 100644 index 0000000..ea02aac --- /dev/null +++ b/test/SemaCXX/exception-spec.cpp @@ -0,0 +1,35 @@ +// 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); // expected-error {{specifications are not allowed in typedefs}} + +// 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}} + +struct Incomplete; + +// Exception spec must not have incomplete types, or pointers to them, except +// void. +void ic1() throw(void); // expected-error {{incomplete type 'void' is not allowed in exception specification}} +void ic2() throw(Incomplete); // expected-error {{incomplete type 'struct Incomplete' is not allowed in exception specification}} +void ic3() throw(void*); +void ic4() throw(Incomplete*); // expected-error {{pointer to incomplete type 'struct Incomplete' is not allowed in exception specification}} +void ic5() throw(Incomplete&); // expected-error {{reference to incomplete type 'struct Incomplete' is not allowed in exception specification}} |