1 // RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
3 struct S
{ S(int); operator bool(); };
10 while (int x
) ; // expected-error {{variable declaration in condition must have an initializer}}
12 if (const int x
= a
) ; // expected-warning{{empty body}} expected-note{{put the semicolon on a separate line to silence this warning}}
13 switch (int x
= a
+10) {}
14 for (; int x
= ++a
; ) ;
17 if (S(a
) = 0) {} // expected-warning {{redundant parentheses}} expected-note 2{{}}
18 if (S(a
) == 0) {} // ok
20 if (S(n
)) {} // expected-error {{unexpected type name 'n': expected expression}}
21 if (S(n
) = 0) {} // expected-warning {{redundant parentheses}} expected-note 2{{}}
22 if (S(n
) == 0) {} // expected-error {{unexpected type name 'n': expected expression}}
24 if (S
b(a
)) {} // expected-error {{variable declaration in condition cannot have a parenthesized initializer}}
26 if (S
b(n
)) {} // expected-error {{a function type is not allowed here}}
27 if (S
b(n
) = 0) {} // expected-error {{a function type is not allowed here}}
28 if (S
b(n
) == 0) {} // expected-error {{a function type is not allowed here}}
33 if (S a
= {s
}) {} // ok
34 if (S a
== {s
}) {} // expected-error {{did you mean '='?}}
37 if (S(b
) = {a
}) {} // ok