xref: /llvm-project/clang/test/SemaHLSL/ArrayParams.hlsl (revision 9434c083475e42f47383f3067fe2a155db5c6a30)
1// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library %s -verify
2
3void fn(int I[5]);     // #fn
4void fn2(int I[3][3]); // #fn2
5
6void call() {
7  float F[5];
8  double D[4];
9  int Long[9];
10  int Short[4];
11  int Same[5];
12
13  fn(F);      // expected-error{{no matching function for call to 'fn'}}
14              // expected-note@#fn{{candidate function not viable: no known conversion from 'float[5]' to 'int[5]' for 1st argument}}
15
16  fn(D);      // expected-error{{no matching function for call to 'fn'}}
17              // expected-note@#fn{{candidate function not viable: no known conversion from 'double[4]' to 'int[5]' for 1st argument}}
18
19  fn(Long);  // expected-error{{no matching function for call to 'fn'}}
20             // expected-note@#fn{{candidate function not viable: no known conversion from 'int[9]' to 'int[5]' for 1st argument}}
21
22  fn(Short); // expected-error{{no matching function for call to 'fn'}}
23             // expected-note@#fn{{candidate function not viable: no known conversion from 'int[4]' to 'int[5]' for 1st argument}}
24
25  fn(Same);  // totally fine, nothing to see here.
26
27  fn2(Long); // expected-error{{no matching function for call to 'fn2'}}
28             // expected-note@#fn2{{candidate function not viable: no known conversion from 'int[9]' to 'int[3][3]' for 1st argument}}
29}
30