blob: a797dba1d22e611ac69b9fed47f2e2756bab208a [file] [log] [blame]
Sebastian Redl6a7330c2009-05-29 15:01:05 +00001// RUN: clang-cc -fsyntax-only -verify %s
2
3// Straight from the standard:
4// Plain function with spec
5void f() throw(int);
6// Pointer to function with spec
7void (*fp)() throw (int);
8// Function taking reference to function with spec
9void g(void pfa() throw(int));
10// Typedef for pointer to function with spec
11typedef int (*pf)() throw(int); // xpected-error spec-on-typedef
12
13// Some more:
14// Function returning function with spec
15void (*h())() throw(int);
16// Ultimate parser thrill: function with spec returning function with spec and
17// taking pointer to function with spec.
18// The actual function throws int, the return type double, the argument float.
19void (*i() throw(int))(void (*)() throw(float)) throw(double);
20// Pointer to pointer to function taking function with spec
21void (**k)(void pfa() throw(int)); // no-error
22// Pointer to pointer to function with spec
23void (**j)() throw(int); // expected-error {{not allowed beyond a single}}
24// Pointer to function returning pointer to pointer to function with spec
25void (**(*h())())() throw(int); // expected-error {{not allowed beyond a single}}
Sebastian Redlef65f062009-05-29 18:02:33 +000026
27struct Incomplete;
28
29// Exception spec must not have incomplete types, or pointers to them, except
30// void.
31void ic1() throw(void); // expected-error {{incomplete type 'void' is not allowed in exception specification}}
32void ic2() throw(Incomplete); // expected-error {{incomplete type 'struct Incomplete' is not allowed in exception specification}}
33void ic3() throw(void*);
34void ic4() throw(Incomplete*); // expected-error {{pointer to incomplete type 'struct Incomplete' is not allowed in exception specification}}
35void ic5() throw(Incomplete&); // expected-error {{reference to incomplete type 'struct Incomplete' is not allowed in exception specification}}