Skip to content

Commit 70bb063

Browse files
committed
Update tests based on changes that have merged to main
../clang/test/SemaHLSL/Language/ElementwiseCast-errors.hlsl
1 parent 22338cb commit 70bb063

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

clang/test/SemaHLSL/Language/ElementwiseCast-errors.hlsl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,9 @@ export void cantCast4() {
4343
int2 A = {1,2};
4444
R r = R(A);
4545
// expected-error@-1 {{no matching conversion for functional-style cast from 'int2' (aka 'vector<int, 2>') to 'R'}}
46-
R r2 = {1, 2};
46+
R r2;
47+
r2.A = 1;
48+
r2.F = 2.0;
4749
int2 B = (int2)r2;
4850
// expected-error@-1 {{cannot convert 'R' to 'int2' (aka 'vector<int, 2>') without a conversion operator}}
4951
}

clang/test/SemaHLSL/Language/InitLists.hlsl

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,11 +98,24 @@ void Errs() {
9898
int2 Something = {1.xxx}; // expected-error{{too many initializers in list for type 'int2' (aka 'vector<int, 2>') (expected 2 but found 3)}}
9999
}
100100

101+
struct R {
102+
int A;
103+
union { // #anon
104+
float F;
105+
int4 G;
106+
};
107+
};
108+
109+
// expected-note@#anon{{candidate constructor (the implicit copy constructor) not viable: no known conversion from 'int' to}}
110+
// expected-note@#anon{{candidate constructor (the implicit move constructor) not viable: no known conversion from 'int' to}}
111+
101112
void Err2(RWBuffer<float4> B) {
102113
ContainsResource RS1 = {1, B};
103114
ContainsResource RS2 = (1.xx); // expected-error{{no viable conversion from 'vector<int, 2>' (vector of 2 'int' values) to 'ContainsResource'}}
104115
ContainsResource RS3 = {B, 1}; // expected-error{{no viable conversion from 'RWBuffer<float4>' (aka 'RWBuffer<vector<float, 4>>') to 'int'}}
105116
ContainsResourceInverted IR = {RS1}; // expected-error{{no viable conversion from 'int' to 'hlsl::RWBuffer<vector<float, 4>>'}}
117+
118+
R r = {1,2}; // expected-error{{no viable conversion from 'int' to 'R::(anonymous union at}}
106119
}
107120

108121
// expected-note@#ContainsResource{{candidate constructor (the implicit copy constructor) not viable: no known conversion from 'vector<int, 2>' (vector of 2 'int' values) to 'const ContainsResource &' for 1st argument}}

0 commit comments

Comments
 (0)