xref: /llvm-project/clang/test/Sema/countbits-errors.hlsl (revision 67518a44fec0f59b2f926059cf15ec77ec72da13)
1// RUN: %clang_cc1 -finclude-default-header
2// -triple dxil-pc-shadermodel6.6-library %s -fnative-half-type -emit-llvm-only
3// -disable-llvm-passes -verify
4
5double2 test_int_builtin(double2 p0) {
6  return __builtin_hlsl_elementwise_countbits(p0);
7  // expected-error@-1 {{passing 'double2' (aka 'vector<double, 2>') to
8  // parameter of incompatible type
9  // '__attribute__((__vector_size__(2 * sizeof(int)))) int'
10  // (vector of 2 'int' values)}}
11}
12
13float test_ambiguous(float p0) {
14  return countbits(p0);
15  // expected-error@-1 {{call to 'countbits' is ambiguous}}
16  // expected-note@hlsl/hlsl_intrinsics.h:* {{candidate function}}
17  // expected-note@hlsl/hlsl_intrinsics.h:* {{candidate function}}
18  // expected-note@hlsl/hlsl_intrinsics.h:* {{candidate function}}
19  // expected-note@hlsl/hlsl_intrinsics.h:* {{candidate function}}
20  // expected-note@hlsl/hlsl_intrinsics.h:* {{candidate function}}
21  // expected-note@hlsl/hlsl_intrinsics.h:* {{candidate function}}
22}
23
24float test_float_builtin(float p0) {
25  return __builtin_hlsl_elementwise_countbits(p0);
26  // expected-error@-1 {{passing 'double' to parameter of incompatible type
27  // 'int'}}
28}
29