Sebastian Redl | 6a7330c | 2009-05-29 15:01:05 +0000 | [diff] [blame^] | 1 | // RUN: clang-cc -fsyntax-only -verify %s |
| 2 | |
| 3 | // Straight from the standard: |
| 4 | // Plain function with spec |
| 5 | void f() throw(int); |
| 6 | // Pointer to function with spec |
| 7 | void (*fp)() throw (int); |
| 8 | // Function taking reference to function with spec |
| 9 | void g(void pfa() throw(int)); |
| 10 | // Typedef for pointer to function with spec |
| 11 | typedef int (*pf)() throw(int); // xpected-error spec-on-typedef |
| 12 | |
| 13 | // Some more: |
| 14 | // Function returning function with spec |
| 15 | void (*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. |
| 19 | void (*i() throw(int))(void (*)() throw(float)) throw(double); |
| 20 | // Pointer to pointer to function taking function with spec |
| 21 | void (**k)(void pfa() throw(int)); // no-error |
| 22 | // Pointer to pointer to function with spec |
| 23 | void (**j)() throw(int); // expected-error {{not allowed beyond a single}} |
| 24 | // Pointer to function returning pointer to pointer to function with spec |
| 25 | void (**(*h())())() throw(int); // expected-error {{not allowed beyond a single}} |