brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1007 B · fbb47bd Raw
44 lines · plain
1// RUN: %clang_cc1 -finclude-default-header -triple dxil-pc-shadermodel6.6-library %s -verify -verify-ignore-unexpected=note2 3struct S {4  int A : 8;5  int B;6};7 8struct R {9  int A;10  union {11    float F;12    int4 G;13  };14};15 16// Can't cast a union17export void cantCast2() {18  R r = (R)1;19  // expected-error@-1 {{no matching conversion for C-style cast from 'int' to 'R'}}20}21 22RWBuffer<float4> Buf;23 24// Can't cast an intangible type25export void cantCast3() {26  Buf = (RWBuffer<float4>)1;27  // expected-error@-1 {{no matching conversion for C-style cast from 'int' to 'RWBuffer<float4>' (aka 'RWBuffer<vector<float, 4>>')}}28}29 30export void cantCast4() {31 RWBuffer<float4> B[2] = (RWBuffer<float4>[2])1;32 // expected-error@-1 {{C-style cast from 'int' to 'RWBuffer<float4>[2]' (aka 'RWBuffer<vector<float, 4>>[2]') is not allowed}}33}34 35struct X {36  int A;37  RWBuffer<float4> Buf;38};39 40export void cantCast5() {41  X x = (X)1;42  // expected-error@-1 {{no matching conversion for C-style cast from 'int' to 'X'}}43}44