summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/diagnostics/invalid-constraint.slang27
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/diagnostics/invalid-constraint.slang b/tests/diagnostics/invalid-constraint.slang
new file mode 100644
index 000000000..667077ffb
--- /dev/null
+++ b/tests/diagnostics/invalid-constraint.slang
@@ -0,0 +1,27 @@
+//DIAGNOSTIC_TEST:SIMPLE(filecheck=CHECK):
+
+interface IFoo
+{
+ This foo();
+}
+
+struct Foo : IFoo
+{
+ float x;
+ This foo()
+ {
+ This f;
+ f.x = 0.0;
+ return f;
+ }
+}
+
+RWStructuredBuffer<float> output;
+
+// CHECK: ([[# @LINE+1]]): error 30401
+float compute<T:Foo>(T f) // error, should be IFoo here.
+{
+}
+
+void main()
+{}