1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s 2*f4a2713aSLionel Sambuc 3*f4a2713aSLionel Sambuc struct x { 4*f4a2713aSLionel Sambuc x() : a(4) ; // expected-error {{expected '{'}} 5*f4a2713aSLionel Sambuc }; 6*f4a2713aSLionel Sambuc 7*f4a2713aSLionel Sambuc struct y { 8*f4a2713aSLionel Sambuc int a; 9*f4a2713aSLionel Sambuc y() : a(4) ; // expected-error {{expected '{'}} 10*f4a2713aSLionel Sambuc }; 11*f4a2713aSLionel Sambuc 12*f4a2713aSLionel Sambuc struct z { 13*f4a2713aSLionel Sambuc int a; 14*f4a2713aSLionel Sambuc z() : a {} 15*f4a2713aSLionel Sambuc }; // expected-error {{expected '{'}} 16*f4a2713aSLionel Sambuc 17*f4a2713aSLionel Sambuc namespace PR16480 { 18*f4a2713aSLionel Sambuc template<int n> struct X { 19*f4a2713aSLionel Sambuc X(); 20*f4a2713aSLionel Sambuc X(int); 21*f4a2713aSLionel Sambuc }; 22*f4a2713aSLionel Sambuc 23*f4a2713aSLionel Sambuc struct A : X<0> { 24*f4a2713aSLionel Sambuc A() : X<a<b>{0}.n>() {} 25*f4a2713aSLionel Sambuc 26*f4a2713aSLionel Sambuc template<int> struct a { 27*f4a2713aSLionel Sambuc int n; 28*f4a2713aSLionel Sambuc }; 29*f4a2713aSLionel Sambuc 30*f4a2713aSLionel Sambuc static const int b = 1; 31*f4a2713aSLionel Sambuc }; 32*f4a2713aSLionel Sambuc 33*f4a2713aSLionel Sambuc struct B : X<0> { 34*f4a2713aSLionel Sambuc B() : X<a<b>{0} {} 35*f4a2713aSLionel Sambuc 36*f4a2713aSLionel Sambuc static const int a = 0, b = 0; 37*f4a2713aSLionel Sambuc }; 38*f4a2713aSLionel Sambuc 39*f4a2713aSLionel Sambuc template<int> struct a { 40*f4a2713aSLionel Sambuc constexpr a(int) {} 41*f4a2713aSLionel Sambuc constexpr operator int() const { return 0; } 42*f4a2713aSLionel Sambuc }; 43*f4a2713aSLionel Sambuc 44*f4a2713aSLionel Sambuc struct C : X<0> { 45*f4a2713aSLionel Sambuc C() : X<a<b>(0)>() {} 46*f4a2713aSLionel Sambuc 47*f4a2713aSLionel Sambuc static const int b = 0; 48*f4a2713aSLionel Sambuc }; 49*f4a2713aSLionel Sambuc 50*f4a2713aSLionel Sambuc struct D : X<0> { 51*f4a2713aSLionel Sambuc D() : X<a<b>(0) {} 52*f4a2713aSLionel Sambuc 53*f4a2713aSLionel Sambuc static const int a = 0, b = 0; 54*f4a2713aSLionel Sambuc }; 55*f4a2713aSLionel Sambuc 56*f4a2713aSLionel Sambuc template<typename T> struct E : X<0> { 57*f4a2713aSLionel Sambuc E(X<0>) : X<(0)>{} {} 58*f4a2713aSLionel Sambuc E(X<1>) : X<int{}>{} {} 59*f4a2713aSLionel Sambuc E(X<2>) : X<(0)>() {} 60*f4a2713aSLionel Sambuc E(X<3>) : X<int{}>() {} 61*f4a2713aSLionel Sambuc }; 62*f4a2713aSLionel Sambuc 63*f4a2713aSLionel Sambuc // FIXME: This should be valid in the union of C99 and C++11. 64*f4a2713aSLionel Sambuc struct F : X<0> { 65*f4a2713aSLionel Sambuc F() : X<A<T>().n + (T){}.n>{} {} // expected-error +{{}} 66*f4a2713aSLionel Sambuc 67*f4a2713aSLionel Sambuc struct T { int n; }; 68*f4a2713aSLionel Sambuc template<typename> struct A { int n; }; 69*f4a2713aSLionel Sambuc }; // expected-error +{{}} 70*f4a2713aSLionel Sambuc 71*f4a2713aSLionel Sambuc // FIXME: This is valid now, but may be made ill-formed by DR1607. 72*f4a2713aSLionel Sambuc struct G : X<0> { 73*f4a2713aSLionel Sambuc G() : X<0 && [](){return 0;}()>{} // expected-error +{{}} 74*f4a2713aSLionel Sambuc }; // expected-error +{{}} 75*f4a2713aSLionel Sambuc 76*f4a2713aSLionel Sambuc struct Errs : X<0> { 77*f4a2713aSLionel Sambuc Errs(X<0>) : decltype X<0>() {} // expected-error {{expected '(' after 'decltype'}} 78*f4a2713aSLionel Sambuc Errs(X<1>) : what is this () {} // expected-error {{expected '(' or '{'}} 79*f4a2713aSLionel Sambuc Errs(X<2>) : decltype(X<0> // expected-note {{to match this '('}} 80*f4a2713aSLionel Sambuc }; // expected-error {{expected ')'}} 81*f4a2713aSLionel Sambuc } 82