blob: 324f6b5f9f88ad6e20b1456eafa61985ce033a36 [file] [log] [blame]
Argyrios Kyrtzidisf303e8a2009-05-22 23:05:39 +00001// RUN: clang-cc -fsyntax-only -pedantic -verify %s
Argyrios Kyrtzidisf58f45e2009-05-22 10:24:42 +00002
3void f() {
4 typedef int T;
5 int x, *px;
6
7 // Type id.
Sebastian Redl9cc11e72009-07-25 15:41:38 +00008 (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 Kyrtzidisf58f45e2009-05-22 10:24:42 +000011
12 // Expression.
13 x = (T());
14 x = (T())/x;
Argyrios Kyrtzidisf303e8a2009-05-22 23:05:39 +000015
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 Friedmanb53f08a2009-05-25 19:41:42 +000019
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 Kyrtzidisf58f45e2009-05-22 10:24:42 +000026}