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