diff options
| author | Yong He <yonghe@outlook.com> | 2024-03-14 14:14:18 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-03-14 14:14:18 -0700 |
| commit | 78d4df0644b20b8ba4eeff459c749c4e8d261345 (patch) | |
| tree | 0fec98d03281134cc46a0cc96cfd48b6107b159f /tests/diagnostics | |
| parent | ba65c212f71a9033c11657936f202f67b01abf23 (diff) | |
Add diagnostic on invalid type constraint. (#3769)
Diffstat (limited to 'tests/diagnostics')
| -rw-r--r-- | tests/diagnostics/invalid-constraint.slang | 27 |
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() +{} |
