summaryrefslogtreecommitdiffstats
path: root/tests/diagnostics/nested-struct-with-unbounded.slang
blob: 4271ad9ab300db2111abbb562b7953ec368c4e8b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// Test that arrays and StructuredBuffers of nested structs with unbounded arrays are not allowed

//TEST:SIMPLE(filecheck=CHECK): -target spirv -allow-glsl -stage compute -entry computeMain

// Struct containing unbounded array (must be last member)
struct StructWithUnbounded
{
    float value;
    int data[];  // Unbounded array must be last member
}

// Nested case
struct NestedUnbounded
{
    int id;
    StructWithUnbounded nested;  // Struct with unbounded array member
}

// Array of nested struct - should error
//CHECK: ([[# @LINE+1]]): error 30027
NestedUnbounded nestedArray[5];

// StructuredBuffer of nested struct - should error
//CHECK: ([[# @LINE+1]]): error 30028
StructuredBuffer<NestedUnbounded> nestedBuffer;

[numthreads(1, 1, 1)]
void computeMain()
{
    // Empty - we're just testing the declarations
}