diff options
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/diagnostics/call-instance-from-static.slang | 21 | ||||
| -rw-r--r-- | tests/diagnostics/call-instance-from-static.slang.expected | 6 |
2 files changed, 27 insertions, 0 deletions
diff --git a/tests/diagnostics/call-instance-from-static.slang b/tests/diagnostics/call-instance-from-static.slang new file mode 100644 index 000000000..3cb8af502 --- /dev/null +++ b/tests/diagnostics/call-instance-from-static.slang @@ -0,0 +1,21 @@ +// call-instance-from-static.slang + +// Test that calling an instance method from a static method is an error. + +//DIAGNOSTIC_TEST:SIMPLE:-target hlsl -entry main -stage compute + +struct Test +{ + void instanceMethod() + {} + + static void staticMethod() + { + instanceMethod(); + } +} + +void main() +{ + Test.staticMethod(); +}
\ No newline at end of file diff --git a/tests/diagnostics/call-instance-from-static.slang.expected b/tests/diagnostics/call-instance-from-static.slang.expected new file mode 100644 index 000000000..6be3f7cd5 --- /dev/null +++ b/tests/diagnostics/call-instance-from-static.slang.expected @@ -0,0 +1,6 @@ +result code = -1 +standard error = { +tests/diagnostics/call-instance-from-static.slang(14): error 30100: type 'Test' cannot be used to refer to non-static member 'instanceMethod' +} +standard output = { +} |
