62 lines · plain
1// RUN: %clang_cc1 -finclude-default-header -triple dxil-pc-shadermodel6.6-library %s -fnative-half-type -fnative-int16-type -disable-llvm-passes -verify2 3void test_too_few_arg()4{5 return cross();6 // expected-error@-1 {{no matching function for call to 'cross'}}7 // expected-note@hlsl/hlsl_alias_intrinsics.h:* {{candidate function not viable: requires 2 arguments, but 0 were provided}}8 // expected-note@hlsl/hlsl_alias_intrinsics.h:* {{candidate function not viable: requires 2 arguments, but 0 were provided}}9}10 11void test_too_few_arg_f32()12{13 return __builtin_hlsl_crossf32();14 // expected-error@-1 {{too few arguments to function call, expected 2, have 0}}15}16 17void test_too_few_arg_f16()18{19 return __builtin_hlsl_crossf16();20 // expected-error@-1 {{too few arguments to function call, expected 2, have 0}}21}22 23void test_too_many_arg(float3 p0)24{25 return cross(p0, p0, p0);26 // expected-error@-1 {{no matching function for call to 'cross'}}27 // expected-note@hlsl/hlsl_alias_intrinsics.h:* {{candidate function not viable: requires 2 arguments, but 3 were provided}}28 // expected-note@hlsl/hlsl_alias_intrinsics.h:* {{candidate function not viable: requires 2 arguments, but 3 were provided}}29}30 31void test_too_many_arg_f32(float3 p0)32{33 return __builtin_hlsl_crossf32(p0, p0, p0);34 // expected-error@-1 {{too many arguments to function call, expected 2, have 3}}35}36 37void test_too_many_arg_f16(half3 p0)38{39 return __builtin_hlsl_crossf16(p0, p0, p0);40 // expected-error@-1 {{too many arguments to function call, expected 2, have 3}}41}42 43bool2 builtin_cross_int2_to_float2_promotion(int2 p1)44{45 return __builtin_hlsl_crossf32(p1, p1);46 // expected-error@-1 {{cannot initialize a parameter of type 'vector<float, 3>' (vector of 3 'float' values) with an lvalue of type 'int2' (aka 'vector<int, 2>')}}47}48 49float2 builtin_cross_float2(float2 p1, float2 p2)50{51 return __builtin_hlsl_crossf32(p1, p2);52 // expected-error@-1 {{cannot initialize a parameter of type 'vector<float, 3>' (vector of 3 'float' values) with an lvalue of type 'float2' (aka 'vector<float, 2>')}}53}54 55void test_ambiguous(int p0)56{57 return cross(p0,p0);58 // expected-error@-1 {{call to 'cross' is ambiguous}}59 // expected-note@hlsl/hlsl_alias_intrinsics.h:* {{candidate function}}60 // expected-note@hlsl/hlsl_alias_intrinsics.h:* {{candidate function}}61}62