1 // RUN: %clang_cc1 -fsyntax-only -pedantic -verify %s
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 ()'}}
17 // Make sure stuff inside the parens are parsed only once (only one warning).
18 x
= (PT()[(int){1}]); // expected-warning {{compound literals}}
20 // Special case: empty parens is a call, not an expression
21 struct S
{int operator()();};
24 // Special case: "++" is postfix here, not prefix
25 (S())++; // expected-error {{cannot increment value of type 'S'}}
27 struct X
{ int &operator++(int); X
operator[](int); int &operator++(); };
28 int &postfix_incr
= (X()[3])++;
29 (X())++ ++; // ok, not a C-style cast
30 (X())++ ++X(); // expected-error {{C-style cast from 'int' to 'X ()'}}
34 // Make sure we do tentative parsing correctly in conditions.
36 struct rec
{ rec(int); };
40 struct rec
{ rec(int); };
45 struct rec
{ rec(int); };
49 template <class T
> result(T
);
54 if (result((cls::type
) i
).check())
57 if (result((ns::type
) i
).check())
60 if (result((::type
) i
).check())
63 if (result((cls::rec
) i
).check())
66 if (result((ns::rec
) i
).check())
69 if (result((::rec
) i
).check())