Argyrios Kyrtzidis | f303e8a | 2009-05-22 23:05:39 +0000 | [diff] [blame] | 1 | // RUN: clang-cc -fsyntax-only -pedantic -verify %s |
Argyrios Kyrtzidis | f58f45e | 2009-05-22 10:24:42 +0000 | [diff] [blame] | 2 | |
| 3 | void f() { |
| 4 | typedef int T; |
| 5 | int x, *px; |
| 6 | |
| 7 | // Type id. |
Sebastian Redl | 9cc11e7 | 2009-07-25 15:41:38 +0000 | [diff] [blame] | 8 | (T())x; // expected-error {{cast from 'int' to 'T ()'}} |
| 9 | (T())+x; // expected-error {{cast from 'int' to 'T ()'}} |
| 10 | (T())*px; // expected-error {{cast from 'int' to 'T ()'}} |
Argyrios Kyrtzidis | f58f45e | 2009-05-22 10:24:42 +0000 | [diff] [blame] | 11 | |
| 12 | // Expression. |
| 13 | x = (T()); |
| 14 | x = (T())/x; |
Argyrios Kyrtzidis | f303e8a | 2009-05-22 23:05:39 +0000 | [diff] [blame] | 15 | |
| 16 | typedef int *PT; |
| 17 | // Make sure stuff inside the parens are parsed only once (only one warning). |
| 18 | x = (PT()[(int){1}]); // expected-warning {{compound literals}} |
Eli Friedman | b53f08a | 2009-05-25 19:41:42 +0000 | [diff] [blame] | 19 | |
| 20 | // Special case: empty parens is a call, not an expression |
| 21 | struct S{int operator()();}; |
| 22 | (S())(); |
| 23 | |
| 24 | // FIXME: Special case: "++" is postfix here, not prefix |
| 25 | // (S())++; |
Argyrios Kyrtzidis | f58f45e | 2009-05-22 10:24:42 +0000 | [diff] [blame] | 26 | } |