summaryrefslogtreecommitdiff
path: root/tests/diagnostics
diff options
context:
space:
mode:
Diffstat (limited to 'tests/diagnostics')
-rw-r--r--tests/diagnostics/generic-invalid-type-specialization.slang20
-rw-r--r--tests/diagnostics/generic-invalid-type-specialization.slang.expected8
2 files changed, 28 insertions, 0 deletions
diff --git a/tests/diagnostics/generic-invalid-type-specialization.slang b/tests/diagnostics/generic-invalid-type-specialization.slang
new file mode 100644
index 000000000..28d155643
--- /dev/null
+++ b/tests/diagnostics/generic-invalid-type-specialization.slang
@@ -0,0 +1,20 @@
+//DIAGNOSTIC_TEST:SIMPLE:
+
+//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name outputBuffer
+RWStructuredBuffer<int> outputBuffer;
+
+struct Check<T>
+{
+ T v;
+};
+
+[numthreads(4, 1, 1)]
+void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
+{
+ int index = dispatchThreadID.x;
+
+ // Invalid as should only accept a type
+ Check<2 + 2> v;
+
+ outputBuffer[index] = index;
+}
diff --git a/tests/diagnostics/generic-invalid-type-specialization.slang.expected b/tests/diagnostics/generic-invalid-type-specialization.slang.expected
new file mode 100644
index 000000000..b3c75c760
--- /dev/null
+++ b/tests/diagnostics/generic-invalid-type-specialization.slang.expected
@@ -0,0 +1,8 @@
+result code = -1
+standard error = {
+tests/diagnostics/generic-invalid-type-specialization.slang(17): error 30060: expected a type, got a 'InfixExpr'
+ Check<2 + 2> v;
+ ^
+}
+standard output = {
+}