1 // RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
4 x() : a(4) ; // expected-error {{expected '{'}}
9 y() : a(4) ; // expected-error {{expected '{'}}
15 }; // expected-error {{expected '{'}}
18 template<int n
> struct X
{
24 A() : X
<a
<b
>{0}.n
>() {}
26 template<int> struct a
{
30 static const int b
= 1;
36 static const int a
= 0, b
= 0;
39 template<int> struct a
{
41 constexpr operator int() const { return 0; }
47 static const int b
= 0;
53 static const int a
= 0, b
= 0;
56 template<typename T
> struct E
: X
<0> {
58 E(X
<1>) : X
<int{}>{} {}
60 E(X
<3>) : X
<int{}>() {}
63 // FIXME: This should be valid in the union of C99 and C++11.
65 F() : X
<A
<T
>().n
+ (T
){}.n
>{} {} // expected-error +{{}} expected-note {{to match}}
68 template<typename
> struct A
{ int n
; };
71 // FIXME: This is valid now, but may be made ill-formed by DR1607.
73 G() : X
<0 && [](){return 0;}()>{} // expected-error +{{}} expected-note {{to match}}
77 Errs(X
<0>) : decltype X
<0>() {} // expected-error {{expected '(' after 'decltype'}}
78 Errs(X
<1>) : what is
this () {} // expected-error {{expected '(' or '{'}}
79 Errs(X
<2>) : decltype(X
<0> // expected-note {{to match this '('}}
80 }; // expected-error {{expected ')'}}
83 template <class U
, class V
> struct C
{
96 // These are all valid:
97 void f(int x
= C
<int, D
>().f()) {}
98 void g(int x
= C
<int, ::D
>().f()) {}
99 void h(int x
= C
<int, N::E
>().f()) {}
100 void i(int x
= C
<int, ::N::E
>().f()) {}
101 void j(int x
= C
<int, decltype(N::E())::F
>().f()) {}
102 void k(int x
= C
<int, C
<int, int>>().f()) {}
103 void l(int x
= C
<int, C
<int, int>::C1
>().f()) {}
105 // This isn't, but it shouldn't crash. The diagnostics don't matter much.
106 void m(int x
= C
<int, union int>().f()) {} // expected-error {{declaration of anonymous union must be a definition}} expected-error {{expected a type}} expected-error {{expected '>'}} expected-note {{to match}}