| 1 |
// RUN: %clang_cc1 -finclude-default-header -triple dxil-pc-shadermodel6.6-library %s -verify -verify-ignore-unexpected=note |
| 2 |
|
| 3 |
struct S { |
| 4 |
int A : 8; |
| 5 |
int B; |
| 6 |
}; |
| 7 |
|
| 8 |
struct R { |
| 9 |
int A; |
| 10 |
union { |
| 11 |
float F; |
| 12 |
int4 G; |
| 13 |
}; |
| 14 |
}; |
| 15 |
|
| 16 |
// Can't cast a union |
| 17 |
export void cantCast2() { |
| 18 |
R r = (R)1; |
| 19 |
// expected-error@-1 {{no matching conversion for C-style cast from 'int' to 'R'}} |
| 20 |
} |
| 21 |
|
| 22 |
RWBuffer<float4> Buf; |
| 23 |
|
| 24 |
// Can't cast an intangible type |
| 25 |
export 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 |
|
| 30 |
export 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 |
|
| 35 |
struct X { |
| 36 |
int A; |
| 37 |
RWBuffer<float4> Buf; |
| 38 |
}; |
| 39 |
|
| 40 |
export void cantCast5() { |
| 41 |
X x = (X)1; |
| 42 |
// expected-error@-1 {{no matching conversion for C-style cast from 'int' to 'X'}} |
| 43 |
} |