Skip to content

Commit 0bdc993

Browse files
committed
Added fmod Sema error checks
1 parent 6c454ba commit 0bdc993

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
// RUN: %clang_cc1 -finclude-default-header -x hlsl -triple dxil-pc-shadermodel6.6-library %s -fnative-half-type -emit-llvm-only -disable-llvm-passes -verify
2+
3+
float test_no_second_arg(float2 p0) {
4+
return fmod(p0);
5+
// expected-error@-1 {{no matching function for call to 'fmod'}}
6+
// expected-note@hlsl/hlsl_intrinsics.h:* {{candidate function not viable: requires 2 arguments, but 1 was provided}}
7+
// expected-note@hlsl/hlsl_intrinsics.h:* {{candidate function not viable: requires 2 arguments, but 1 was provided}}
8+
// expected-note@hlsl/hlsl_intrinsics.h:* {{candidate function template not viable: requires 2 arguments, but 1 was provided}}
9+
// expected-note@hlsl/hlsl_intrinsics.h:* {{candidate function template not viable: requires 2 arguments, but 1 was provided}}
10+
}
11+
12+
float test_too_many_arg(float2 p0) {
13+
return fmod(p0, p0, p0);
14+
// expected-error@-1 {{no matching function for call to 'fmod'}}
15+
// expected-note@hlsl/hlsl_intrinsics.h:* {{candidate function not viable: requires 2 arguments, but 3 were provided}}
16+
// expected-note@hlsl/hlsl_intrinsics.h:* {{candidate function not viable: requires 2 arguments, but 3 were provided}}
17+
// expected-note@hlsl/hlsl_intrinsics.h:* {{candidate function template not viable: requires 2 arguments, but 3 were provided}}
18+
// expected-note@hlsl/hlsl_intrinsics.h:* {{candidate function template not viable: requires 2 arguments, but 3 were provided}}
19+
}
20+
21+
float test_double_inputs(double p0, double p1) {
22+
return fmod(p0, p1);
23+
// expected-error@-1 {{call to 'fmod' is ambiguous}}
24+
// expected-note@hlsl/hlsl_intrinsics.h:* {{candidate function}}
25+
// expected-note@hlsl/hlsl_intrinsics.h:* {{candidate function}}
26+
}
27+
28+
float test_int_inputs(int p0, int p1) {
29+
return fmod(p0, p1);
30+
// expected-error@-1 {{call to 'fmod' is ambiguous}}
31+
// expected-note@hlsl/hlsl_intrinsics.h:* {{candidate function}}
32+
// expected-note@hlsl/hlsl_intrinsics.h:* {{candidate function}}
33+
}

0 commit comments

Comments
 (0)