| 1 |
// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-compute -x hlsl -fsyntax-only -verify %s |
| 2 |
|
| 3 |
typedef float float2 __attribute__((ext_vector_type(2))); |
| 4 |
typedef float float3 __attribute__((ext_vector_type(3))); |
| 5 |
|
| 6 |
struct S { float f; }; |
| 7 |
struct S2 { float f; int i; }; |
| 8 |
|
| 9 |
[numthreads(1,1,1)] |
| 10 |
void entry() { |
| 11 |
float2 LilVec = float2(1.0, 2.0); |
| 12 |
float2 BrokenVec = float2(1.0, 2.0, 3.0); // expected-error{{excess elements in vector initializer}} |
| 13 |
float3 NormieVec = float3(LilVec, 3.0, 4.0); // expected-error{{excess elements in vector initializer}} |
| 14 |
float3 BrokenNormie = float3(3.0, 4.0); // expected-error{{too few elements in vector initialization (expected 3 elements, have 2)}} |
| 15 |
float3 OverwhemledNormie = float3(3.0, 4.0, 5.0, 6.0); // expected-error{{excess elements in vector initializer}} |
| 16 |
|
| 17 |
// These _should_ work in HLSL but aren't yet supported. |
| 18 |
S s; |
| 19 |
float2 GettingStrange = float2(s, s); // expected-error{{no viable conversion from 'S' to 'float'}} expected-error{{no viable conversion from 'S' to 'float'}} |
| 20 |
S2 s2; |
| 21 |
float2 EvenStranger = float2(s2); // expected-error{{cannot convert 'S2' to 'float2' (vector of 2 'float' values) without a conversion operator}} |
| 22 |
} |