1*89fb8490SChris B// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-compute -finclude-default-header -verify -Wdouble-promotion -Wconversion %s 2*89fb8490SChris B 3*89fb8490SChris Bvoid OutVecFn(out float3) {} 4*89fb8490SChris Bvoid InOutVecFn(inout float3) {} 5*89fb8490SChris B 6*89fb8490SChris B// Case 1: Calling out and inout parameters with types that cannot be 7*89fb8490SChris B// back-converted. In HLSL 2021 and earlier this only occurs when passing scalar 8*89fb8490SChris B// arguments to vector parameters because scalar->vector conversion is implicit, 9*89fb8490SChris B// but vector->scalar is not. 10*89fb8490SChris Bvoid case1() { 11*89fb8490SChris B float f; 12*89fb8490SChris B int i; 13*89fb8490SChris B OutVecFn(f); // expected-error{{illegal scalar extension cast on argument f to out paramemter}} 14*89fb8490SChris B InOutVecFn(f); // expected-error{{illegal scalar extension cast on argument f to inout paramemter}} 15*89fb8490SChris B 16*89fb8490SChris B OutVecFn(i); // expected-error{{illegal scalar extension cast on argument i to out paramemter}} 17*89fb8490SChris B InOutVecFn(i); // expected-error{{illegal scalar extension cast on argument i to inout paramemter}} 18*89fb8490SChris B} 19*89fb8490SChris B 20*89fb8490SChris B// Case 2: Conversion warnings on argument initialization. Clang generates 21*89fb8490SChris B// implicit conversion warnings only on the writeback conversion for `out` 22*89fb8490SChris B// parameters since the parameter is not initialized from the argument. Clang 23*89fb8490SChris B// generates implicit conversion warnings on both the parameter initialization 24*89fb8490SChris B// and the writeback for `inout` parameters since the parameter is both copied 25*89fb8490SChris B// in and out of the function. 26*89fb8490SChris B 27*89fb8490SChris Bvoid OutFloat(out float) {} 28*89fb8490SChris Bvoid InOutFloat(inout float) {} 29*89fb8490SChris B 30*89fb8490SChris Bvoid case2() { 31*89fb8490SChris B double f; 32*89fb8490SChris B OutFloat(f); // expected-warning{{implicit conversion increases floating-point precision: 'float' to 'double'}} 33*89fb8490SChris B InOutFloat(f); // expected-warning{{implicit conversion increases floating-point precision: 'float' to 'double'}} expected-warning{{implicit conversion loses floating-point precision: 'double' to 'float'}} 34*89fb8490SChris B} 35