1// RUN: %clang_cc1 -finclude-default-header -triple dxil-pc-shadermodel6.6-library %s -verify 2 3void increment(inout int Arr[2]) { 4 for (int I = 0; I < 2; I++) 5 Arr[0] += 2; 6} 7 8export int wrongSize() { 9 int A[3] = { 0, 1, 2 }; 10 increment(A); 11 // expected-error@-1 {{no matching function for call to 'increment'}} 12 // expected-note@*:* {{candidate function not viable: no known conversion from 'int[3]' to 'int[2]' for 1st argument}} 13 return A[0]; 14} 15 16export int wrongSize2() { 17 int A[1] = { 0 }; 18 increment(A); 19 // expected-error@-1 {{no matching function for call to 'increment'}} 20 // expected-note@*:* {{candidate function not viable: no known conversion from 'int[1]' to 'int[2]' for 1st argument}} 21 return A[0]; 22} 23 24export void tooFewArgs() { 25 increment(); 26 // expected-error@-1 {{no matching function for call to 'increment'}} 27 // expected-note@*:* {{candidate function not viable: requires single argument 'Arr', but no arguments were provided}} 28} 29 30export float wrongType() { 31 float A[2] = { 0, 1 }; 32 increment(A); 33 // expected-error@-1 {{no matching function for call to 'increment'}} 34 // expected-note@*:* {{candidate function not viable: no known conversion from 'float[2]' to 'int[2]' for 1st argument}} 35 return A[0]; 36} 37 38export int wrongType2() { 39 increment(5); 40 // expected-error@-1 {{no matching function for call to 'increment'}} 41 // expected-note@*:* {{candidate function not viable: no known conversion from 'int' to 'int[2]' for 1st argument}} 42 return 1; 43} 44 45export void tooManyArgs() { 46 int A[2] = { 0, 1 }; 47 int B[2] = { 2, 3 }; 48 increment(A, B); 49 // expected-error@-1 {{no matching function for call to 'increment'}} 50 // expected-note@*:* {{candidate function not viable: requires single argument 'Arr', but 2 arguments were provided}} 51} 52