summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/diagnostics/gh-1374.slang21
-rw-r--r--tests/diagnostics/gh-1374.slang.expected8
2 files changed, 29 insertions, 0 deletions
diff --git a/tests/diagnostics/gh-1374.slang b/tests/diagnostics/gh-1374.slang
new file mode 100644
index 000000000..b1bb04253
--- /dev/null
+++ b/tests/diagnostics/gh-1374.slang
@@ -0,0 +1,21 @@
+// gh-1374.slang
+
+// Test a `static` variable wwith a definition that refers to itself
+
+//DIAGNOSTIC_TEST:REFLECTION:-stage compute -entry main -target hlsl
+
+struct S
+{
+ static const int kVal = kVal;
+
+ static const int kInf = kInf + 1;
+
+ static const int kA = kB;
+ static const int kB = kA;
+}
+
+[numthreads(1, 1, 1)]
+void main(
+ uint3 dispatchThreadID : SV_DispatchThreadID)
+{
+} \ No newline at end of file
diff --git a/tests/diagnostics/gh-1374.slang.expected b/tests/diagnostics/gh-1374.slang.expected
new file mode 100644
index 000000000..7f4e0d8f0
--- /dev/null
+++ b/tests/diagnostics/gh-1374.slang.expected
@@ -0,0 +1,8 @@
+result code = 1
+standard error = {
+tests/diagnostics/gh-1374.slang(9): error 39999: the initial-value expression for variable 'kVal' depends on the value of the variable itself
+tests/diagnostics/gh-1374.slang(11): error 39999: the initial-value expression for variable 'kInf' depends on the value of the variable itself
+tests/diagnostics/gh-1374.slang(14): error 39999: the initial-value expression for variable 'kB' depends on the value of the variable itself
+}
+standard output = {
+}