summaryrefslogtreecommitdiff
path: root/tests/diagnostics
diff options
context:
space:
mode:
Diffstat (limited to 'tests/diagnostics')
-rw-r--r--tests/diagnostics/missing-override.slang20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/diagnostics/missing-override.slang b/tests/diagnostics/missing-override.slang
new file mode 100644
index 000000000..cc2cbcad3
--- /dev/null
+++ b/tests/diagnostics/missing-override.slang
@@ -0,0 +1,20 @@
+//DIAGNOSTIC_TEST:SIMPLE(filecheck=CHECK):
+
+interface IFoo
+{
+ int getVal() { return 0; }
+}
+
+struct Impl : IFoo
+{
+ // Missing override for getVal, which should trigger a diagnostic.
+ // CHECK: ([[# @LINE+1]]): error 30853
+ int getVal() { return 1; }
+}
+
+struct Impl2 : IFoo
+{
+ // Overriding getVal with a different signature should also trigger a diagnostic.
+ // CHECK: ([[# @LINE+1]]): error 30854
+ override int getVal(int x) { return x; }
+} \ No newline at end of file