31 lines · plain
1// RUN: %clang_cc1 -finclude-default-header -triple dxil-pc-shadermodel6.6-library %s -verify2 3export void cantCast() {4 int A[3] = {1,2,3};5 int B[4] = {1,2,3,4};6 B = (int[4])A;7 // expected-error@-1 {{C-style cast from 'int[3]' to 'int[4]' is not allowed}}8}9 10struct R {11// expected-note@-1 {{candidate constructor (the implicit copy constructor) not viable: no known conversion from 'int2' (aka 'vector<int, 2>') to 'const R' for 1st argument}}12// expected-note@-2 {{candidate constructor (the implicit move constructor) not viable: no known conversion from 'int2' (aka 'vector<int, 2>') to 'R' for 1st argument}}13// expected-note@-3 {{candidate constructor (the implicit default constructor) not viable: requires 0 arguments, but 1 was provided}}14 int A;15 union {16 float F;17 int4 G;18 };19};20 21export void cantCast4() {22 int2 A = {1,2};23 R r = R(A);24 // expected-error@-1 {{no matching conversion for functional-style cast from 'int2' (aka 'vector<int, 2>') to 'R'}}25 R r2;26 r2.A = 1;27 r2.F = 2.0;28 int2 B = (int2)r2;29 // expected-error@-1 {{cannot convert 'R' to 'int2' (aka 'vector<int, 2>') without a conversion operator}}30}31