1 // RUN: %clang_cc1 -verify -std=c++11 %s
3 template<typename T
> struct complex {
4 complex(T
= T(), T
= T());
5 void operator+=(complex);
16 a
= { 1 } = b
; // expected-error {{initializer list cannot be used on the left hand side of operator '='}}
17 a
= a
+ { 4 }; // expected-error {{initializer list cannot be used on the right hand side of operator '+'}}
18 a
= { 3 } * { 4 }; // expected-error {{initializer list cannot be used on the left hand side of operator '*'}} \
19 expected
-error
{{initializer list cannot be used on the right hand side of
operator '*'}}
23 constexpr S(int a
, int b
) : a(a
), b(b
) {}
27 constexpr int operator=(S s
) const { return s
.a
; }
28 constexpr int operator+=(S s
) const { return s
.b
; }
30 static_assert((T() = {4, 9}) == 4, "");
31 static_assert((T() += {4, 9}) == 9, "");
33 int k1
= T() = { 1, 2 } = { 3, 4 }; // expected-error {{initializer list cannot be used on the left hand side of operator '='}}
34 int k2
= T() = { 1, 2 } + 1; // expected-error {{initializer list cannot be used on the left hand side of operator '+'}}