Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #1416 from AndrejMitrovic/Fix8787

Issue 8787 - Better diagnostic on non-final interface function with a body
  • Loading branch information...
commit 67ca915e3d89db564217bd6452de6c6799c01f6c 2 parents 6cfa082 + 185f279
Hara Kenji 9rnsr authored
Showing with 15 additions and 1 deletion.
  1. +1 −1  src/func.c
  2. +14 −0 test/fail_compilation/diag8787.d
2  src/func.c
View
@@ -369,7 +369,7 @@ void FuncDeclaration::semantic(Scope *sc)
isNewDeclaration() || isDelete())
error("constructors, destructors, postblits, invariants, new and delete functions are not allowed in interface %s", id->toChars());
if (fbody && isVirtual())
- error("function body is not abstract in interface %s", id->toChars());
+ error("function body only allowed in final functions in interface %s", id->toChars());
}
/* Contracts can only appear without a body when they are virtual interface functions
14 test/fail_compilation/diag8787.d
View
@@ -0,0 +1,14 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/diag8787.d(3): Error: function diag8787.I.f function body only allowed in final functions in interface I
+---
+*/
+
+#line 1
+interface I
+{
+ void f() { }
+}
+
+void main() {}
Please sign in to comment.
Something went wrong with that request. Please try again.