1 // RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++20 -x objective-c++ -fobjc-arc -fenable-matrix -triple i686-pc-win32
13 using A3
= char __attribute__((vector_size(4)));
19 using B4
= A4
__attribute__((matrix_type(4, 4)));
23 using X5
= A4
__attribute__((matrix_type(3, 4)));
24 using Y5
= A4
__attribute__((matrix_type(4, 3)));
26 N t1
= 0 ? X1() : Y1(); // expected-error {{rvalue of type 'B1'}}
27 N t2
= 0 ? X2() : Y2(); // expected-error {{rvalue of type 'B2'}}
31 N t3
= 0 ? xt3
: yt3
; // expected-error {{lvalue of type 'const B1'}}
33 N t4
= X3() + Y3(); // expected-error {{rvalue of type 'B3'}}
35 N t5
= A3() ? X3() : Y3(); // expected-error {{rvalue of type 'B3'}}
36 N t6
= A3() ? X1() : Y1(); // expected-error {{vector condition type 'A3' (vector of 4 'char' values) and result type '__attribute__((__vector_size__(4 * sizeof(B1)))) B1' (vector of 4 'B1' values) do not have elements of the same size}}
38 N t7
= X4() + Y4(); // expected-error {{rvalue of type 'B4'}}
39 N t8
= X4() * Y4(); // expected-error {{rvalue of type 'B4'}}
40 N t9
= X5() * Y5(); // expected-error {{rvalue of type 'A4 __attribute__((matrix_type(3, 3)))'}}
42 template <class T
> struct S1
{
43 template <class U
> struct S2
{};
46 N t10
= 0 ? S1
<X1
>() : S1
<Y1
>(); // expected-error {{from 'S1<B1>' (aka 'S1<int>')}}
47 N t11
= 0 ? S1
<X1
>::S2
<X2
>() : S1
<Y1
>::S2
<Y2
>(); // expected-error {{from 'S1<int>::S2<B2>' (aka 'S2<void>')}}
49 template <class T
> using Al
= S1
<T
>;
51 N t12
= 0 ? Al
<X1
>() : Al
<Y1
>(); // expected-error {{from 'Al<B1>' (aka 'S1<int>')}}
53 #define AS1 __attribute__((address_space(1)))
54 #define AS2 __attribute__((address_space(1)))
58 N t13
= 0 ? (AS1X1
){} : (AS1Y1
){}; // expected-error {{rvalue of type 'AS1 B1' (aka '__attribute__((address_space(1))) int')}}
59 N t14
= 0 ? (AS1X1
){} : (AS2Y1
){}; // expected-error {{rvalue of type '__attribute__((address_space(1))) B1' (aka '__attribute__((address_space(1))) int')}}
63 N t15
= 0 ? (FX1
*){} : (FY1
*){}; // expected-error {{rvalue of type 'B1 (*)()' (aka 'int (*)()')}}
70 using MFX1
= X1
SX1::*();
71 using MFY1
= Y1
SY1::*();
73 N t16
= 0 ? (MFX1
*){} : (MFY1
*){}; // expected-error {{rvalue of type 'B1 SB1::*(*)()'}}
75 N t17
= 0 ? (FX1
SX1::*){} : (FY1
SY1::*){}; // expected-error {{rvalue of type 'B1 (SB1::*)() __attribute__((thiscall))'}}
77 N t18
= 0 ? (__typeof(X1
*)){} : (__typeof(Y1
*)){}; // expected-error {{rvalue of type 'typeof(B1 *)' (aka 'int *')}}
84 using EnumsX
= EnumsB
;
85 using EnumsY
= EnumsB
;
87 N t19
= 0 ? (__underlying_type(EnumsX::X
)){} : (__underlying_type(EnumsY::Y
)){};
88 // expected-error@-1 {{rvalue of type 'B1' (aka 'int')}}
90 N t20
= 0 ? (__underlying_type(EnumsX::X
)){} : (__underlying_type(EnumsY::X
)){};
91 // expected-error@-1 {{rvalue of type '__underlying_type(Enums::X)' (aka 'int')}}
93 using SBTF1
= SS1
[[clang::btf_type_tag("1")]];
94 using SBTF2
= ::SS1
[[clang::btf_type_tag("1")]];
95 using SBTF3
= ::SS1
[[clang::btf_type_tag("2")]];
97 N t21
= 0 ? (SBTF1
){} : (SBTF3
){}; // expected-error {{from 'SS1'}}
98 N t22
= 0 ? (SBTF1
){} : (SBTF2
){}; // expected-error {{from 'SS1 __attribute__((btf_type_tag("1")))' (aka 'SS1')}}
100 using QX
= const SB1
*;
101 using QY
= const ::SB1
*;
102 N t23
= 0 ? (QX
){} : (QY
){}; // expected-error {{rvalue of type 'const SB1 *' (aka 'const SS1 *')}}
104 template <class T
> using Alias
= short;
105 N t24
= 0 ? (Alias
<X1
>){} : (Alias
<Y1
>){}; // expected-error {{rvalue of type 'Alias<B1>' (aka 'short')}}
106 N t25
= 0 ? (Alias
<X1
>){} : (Alias
<X2
>){}; // expected-error {{rvalue of type 'short'}}
108 template <class T
, class U
> concept C1
= true;
109 template <class T
, class U
> concept C2
= true;
110 C1
<X1
> auto t26_1
= (SB1
){};
111 C1
<X2
> auto t26_2
= (::SB1
){};
112 C2
<X2
> auto t26_3
= (::SB1
){};
113 N t26
= 0 ? t26_1
: t26_2
; // expected-error {{from 'SB1' (aka 'SS1')}}
114 N t27
= 0 ? t26_1
: t26_3
; // expected-error {{from 'SB1' (aka 'SS1')}}
118 using RPB1
= Y1
*; // redeclared
120 N t28
= *(RPB1
){}; // expected-error {{lvalue of type 'Y1' (aka 'int')}}
121 auto t29
= 0 ? (RPX1
){} : (RPY1
){};
122 N t30
= t29
; // expected-error {{lvalue of type 'RPB1' (aka 'int *')}}
123 N t31
= *t29
; // expected-error {{lvalue of type 'B1' (aka 'int')}}
125 namespace A
{ using type1
= X1
*; };
126 namespace C
{ using A::type1
; };
127 using UPX1
= C::type1
;
128 namespace A
{ using type1
= Y1
*; }; // redeclared
129 namespace C
{ using A::type1
; }; // redeclared
130 using UPY1
= C::type1
;
131 auto t32
= 0 ? (UPX1
){} : (UPY1
){};
132 N t33
= t32
; // expected-error {{lvalue of type 'C::type1' (aka 'int *')}}
133 N t34
= *t32
; // expected-error {{lvalue of type 'B1' (aka 'int')}}
135 // See https://github.com/llvm/llvm-project/issues/61419
137 template <class T0
, class T1
> struct pair
{
142 extern const pair
<id
, id
> p
;
143 id t
= false ? p
.first
: p
.second
;
144 } // namespace PR61419
147 template <class> using A
= long;
148 template <class B
> void h() {
151 N t
= 0 ? A
<decltype(C())>() : A
<decltype(D())>();
152 // expected-error@-1 {{rvalue of type 'A<decltype(C())>' (aka 'long')}}
154 template void h
<int>();
155 } // namespace GH67603