summaryrefslogtreecommitdiffstats
path: root/tests/diagnostics/nested-struct-with-unbounded.slang
diff options
context:
space:
mode:
Diffstat (limited to 'tests/diagnostics/nested-struct-with-unbounded.slang')
-rw-r--r--tests/diagnostics/nested-struct-with-unbounded.slang31
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/diagnostics/nested-struct-with-unbounded.slang b/tests/diagnostics/nested-struct-with-unbounded.slang
new file mode 100644
index 000000000..4271ad9ab
--- /dev/null
+++ b/tests/diagnostics/nested-struct-with-unbounded.slang
@@ -0,0 +1,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
+} \ No newline at end of file