Daniel Dunbar | d7d5f02 | 2009-03-24 02:24:46 +0000 | [diff] [blame] | 1 | /* RUN: clang-cc -fsyntax-only %s -verify |
Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 2 | */ |
| 3 | |
| 4 | typedef void Void; |
| 5 | |
| 6 | void foo() { |
| 7 | int X; |
| 8 | |
Eli Friedman | 6d1e4b5 | 2008-05-22 08:54:03 +0000 | [diff] [blame] | 9 | X = sizeof(int (void a)); // expected-error {{argument may not have 'void' type}} |
| 10 | X = sizeof(int (int, void)); // expected-error {{must be the first and only parameter}} |
| 11 | X = sizeof(int (void, ...)); // expected-error {{must be the first and only parameter}} |
Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 12 | |
Eli Friedman | 6d1e4b5 | 2008-05-22 08:54:03 +0000 | [diff] [blame] | 13 | X = sizeof(int (Void a)); // expected-error {{argument may not have 'void' type}} |
| 14 | X = sizeof(int (int, Void)); // expected-error {{must be the first and only parameter}} |
| 15 | X = sizeof(int (Void, ...)); // expected-error {{must be the first and only parameter}} |
Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 16 | |
| 17 | // Accept these. |
| 18 | X = sizeof(int (void)); |
| 19 | X = sizeof(int (Void)); |
| 20 | } |
| 21 | |
Chris Lattner | b751c28 | 2007-11-28 18:51:29 +0000 | [diff] [blame] | 22 | // this is ok. |
| 23 | void bar(Void) { |
| 24 | } |
| 25 | |
Eli Friedman | 6d1e4b5 | 2008-05-22 08:54:03 +0000 | [diff] [blame] | 26 | void f(const void); // expected-error {{parameter must not have type qualifiers}} |