1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s 2*f4a2713aSLionel Sambuc 3*f4a2713aSLionel Sambuc struct S { S(int); operator bool(); }; 4*f4a2713aSLionel Sambuc f()5*f4a2713aSLionel Sambucvoid f() { 6*f4a2713aSLionel Sambuc int a; 7*f4a2713aSLionel Sambuc typedef int n; 8*f4a2713aSLionel Sambuc 9*f4a2713aSLionel Sambuc while (a) ; 10*f4a2713aSLionel Sambuc while (int x) ; // expected-error {{variable declaration in condition must have an initializer}} 11*f4a2713aSLionel Sambuc while (float x = 0) ; 12*f4a2713aSLionel Sambuc if (const int x = a) ; // expected-warning{{empty body}} expected-note{{put the semicolon on a separate line to silence this warning}} 13*f4a2713aSLionel Sambuc switch (int x = a+10) {} 14*f4a2713aSLionel Sambuc for (; int x = ++a; ) ; 15*f4a2713aSLionel Sambuc 16*f4a2713aSLionel Sambuc if (S(a)) {} // ok 17*f4a2713aSLionel Sambuc if (S(a) = 0) {} // ok 18*f4a2713aSLionel Sambuc if (S(a) == 0) {} // ok 19*f4a2713aSLionel Sambuc 20*f4a2713aSLionel Sambuc if (S(n)) {} // expected-error {{unexpected type name 'n': expected expression}} 21*f4a2713aSLionel Sambuc if (S(n) = 0) {} // ok 22*f4a2713aSLionel Sambuc if (S(n) == 0) {} // expected-error {{unexpected type name 'n': expected expression}} 23*f4a2713aSLionel Sambuc 24*f4a2713aSLionel Sambuc if (S b(a)) {} // expected-error {{variable declaration in condition cannot have a parenthesized initializer}} 25*f4a2713aSLionel Sambuc 26*f4a2713aSLionel Sambuc if (S b(n)) {} // expected-error {{a function type is not allowed here}} expected-error {{must have an initializer}} 27*f4a2713aSLionel Sambuc if (S b(n) = 0) {} // expected-error {{a function type is not allowed here}} 28*f4a2713aSLionel Sambuc if (S b(n) == 0) {} // expected-error {{a function type is not allowed here}} expected-error {{did you mean '='?}} 29*f4a2713aSLionel Sambuc 30*f4a2713aSLionel Sambuc S s(a); 31*f4a2713aSLionel Sambuc if (S{s}) {} // ok 32*f4a2713aSLionel Sambuc if (S a{s}) {} // ok 33*f4a2713aSLionel Sambuc if (S a = {s}) {} // ok 34*f4a2713aSLionel Sambuc if (S a == {s}) {} // expected-error {{did you mean '='?}} 35*f4a2713aSLionel Sambuc 36*f4a2713aSLionel Sambuc if (S(b){a}) {} // ok 37*f4a2713aSLionel Sambuc if (S(b) = {a}) {} // ok 38*f4a2713aSLionel Sambuc } 39