1 // RUN: %clang_cc1 -triple x86_64-unknown-unknown -fsyntax-only -verify %s
3 // ---------------------------------------------------------------------
5 // ---------------------------------------------------------------------
7 struct ImaginaryLiteral0
{
9 x
= 3.0I
; // expected-error{{incompatible type}}
13 template struct ImaginaryLiteral0
<_Complex
float>;
14 template struct ImaginaryLiteral0
<int*>; // expected-note{{instantiation}}
16 // ---------------------------------------------------------------------
17 // Compound assignment operator
18 // ---------------------------------------------------------------------
22 int& operator+=(X
&, int); // expected-note{{candidate}}
26 long& operator+=(N1::X
&, long);
28 template<typename T
, typename U
, typename Result
>
31 Result r
= t
+= u
; // expected-error{{ambiguous}}
37 struct Y
: public N1::X
{
38 short& operator+=(long); // expected-note{{candidate}}
42 template struct N2::PlusEquals0
<N1::X
, int, int&>;
43 template struct N2::PlusEquals0
<N1::X
, long, long&>;
44 template struct N2::PlusEquals0
<N3::Y
, long, short&>;
45 template struct N2::PlusEquals0
<int, int, int&>;
46 template struct N2::PlusEquals0
<N3::Y
, int, short&>; // expected-note{{instantiation}}
48 // ---------------------------------------------------------------------
49 // Conditional operator
50 // ---------------------------------------------------------------------
51 template<typename T
, typename U
, typename Result
>
54 Result result
= t
? : u
;
58 template struct Conditional0
<int, int, int>;
60 // ---------------------------------------------------------------------
61 // Statement expressions
62 // ---------------------------------------------------------------------
64 struct StatementExpr0
{
67 if (t
) // expected-error{{contextually convertible}}
68 t
= t
+ 17; // expected-error {{invalid operands to binary expression ('N1::X' and 'int')}}
69 t
+ 12; // expected-error{{invalid operands}}
74 template struct StatementExpr0
<int>;
75 template struct StatementExpr0
<N1::X
>; // expected-note{{instantiation}}
77 // ---------------------------------------------------------------------
78 // __builtin_choose_expr
79 // ---------------------------------------------------------------------
80 template<bool Cond
, typename T
, typename U
, typename Result
>
83 Result r
= __builtin_choose_expr(Cond
, t
, u
); // expected-error{{lvalue}}
87 template struct Choose0
<true, int, float, int&>;
88 template struct Choose0
<false, int, float, float&>;
89 template struct Choose0
<true, int, float, float&>; // expected-note{{instantiation}}
91 // ---------------------------------------------------------------------
93 // ---------------------------------------------------------------------
94 template<typename ArgType
>
98 __builtin_va_start(va
, n
);
99 for (int i
= 0; i
!= n
; ++i
)
100 (void)__builtin_va_arg(va
, ArgType
);
101 __builtin_va_end(va
);
105 template struct VaArg0
<int>;
107 template<typename VaList
, typename ArgType
>
111 __builtin_va_start(va
, n
); // expected-error{{int}} expected-error{{char *}}
112 for (int i
= 0; i
!= n
; ++i
)
113 (void)__builtin_va_arg(va
, ArgType
); // expected-error{{int}}
114 __builtin_va_end(va
); // expected-error{{int}} expected-error{{char *}}
118 template struct VaArg1
<__builtin_va_list
, int>;
119 template struct VaArg1
<__builtin_ms_va_list
, int>; // expected-note{{instantiation}}
120 template struct VaArg1
<int, int>; // expected-note{{instantiation}}
122 template<typename ArgType
>
124 void __attribute__((ms_abi
)) f(int n
, ...) {
125 __builtin_ms_va_list va
;
126 __builtin_ms_va_start(va
, n
);
127 for (int i
= 0; i
!= n
; ++i
)
128 (void)__builtin_va_arg(va
, ArgType
);
129 __builtin_ms_va_end(va
);
133 template struct VaArg2
<int>;
135 template<typename VaList
, typename ArgType
>
137 void __attribute__((ms_abi
)) f(int n
, ...) {
139 __builtin_ms_va_start(va
, n
); // expected-error{{int}} expected-error{{__va_list_tag}}
140 for (int i
= 0; i
!= n
; ++i
)
141 (void)__builtin_va_arg(va
, ArgType
); // expected-error{{int}}
142 __builtin_ms_va_end(va
); // expected-error{{int}} expected-error{{__va_list_tag}}
146 template struct VaArg3
<__builtin_ms_va_list
, int>;
147 template struct VaArg3
<__builtin_va_list
, int>; // expected-note{{instantiation}}
148 template struct VaArg3
<int, int>; // expected-note{{instantiation}}