2010-07-26 12:08:02 +08:00
|
|
|
// RUN: %clang_cc1 -fsyntax-only -verify %s
|
2009-02-15 04:20:19 +08:00
|
|
|
|
2012-02-22 14:49:09 +08:00
|
|
|
struct S { S(int); operator bool(); };
|
|
|
|
|
2009-02-15 04:20:19 +08:00
|
|
|
void f() {
|
|
|
|
int a;
|
|
|
|
while (a) ;
|
2012-02-22 14:49:09 +08:00
|
|
|
while (int x) ; // expected-error {{variable declaration in condition must have an initializer}}
|
2009-02-15 04:20:19 +08:00
|
|
|
while (float x = 0) ;
|
2012-02-15 06:14:32 +08:00
|
|
|
if (const int x = a) ; // expected-warning{{empty body}} expected-note{{put the semicolon on a separate line to silence this warning}}
|
2009-02-15 04:20:19 +08:00
|
|
|
switch (int x = a+10) {}
|
|
|
|
for (; int x = ++a; ) ;
|
2012-02-22 14:49:09 +08:00
|
|
|
|
|
|
|
if (S a(42)) {} // expected-error {{variable declaration in condition cannot have a parenthesized initializer}}
|
2009-02-15 04:20:19 +08:00
|
|
|
}
|