Skip to content

Commit 819cae5

Browse files
committed
test for float5 error
1 parent dd0765a commit 819cae5

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

clang/test/SemaHLSL/BuiltIns/clamp-errors.hlsl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,14 @@ float3 test_thing(float3 p0, float2 p1) {
4040
// expected-error@-1 {{cannot initialize return object of type 'float3' (aka 'vector<float, 3>') with an rvalue of type 'vector<float, 2>' (vector of 2 'float' values)}}
4141
}
4242

43+
typedef float float5 __attribute__((ext_vector_type(5)));
44+
45+
// check vectors of wrong size are rejected
46+
float5 vec_too_big(float5 p0) {
47+
return clamp(p0, p0, p0);
48+
// expected-error@-1 {{call to 'clamp' is ambiguous}}
49+
}
50+
4351
float2 test_clamp_vector_size_mismatch(float3 p0, float2 p1) {
4452
return clamp(p0, p0, p1);
4553
// expected-warning@-1 {{implicit conversion truncates vector: 'float3' (aka 'vector<float, 3>') to 'vector<float, 2>' (vector of 2 'float' values)}}

0 commit comments

Comments
 (0)