Browse files

Merge pull request #1416 from AndrejMitrovic/Fix8787

Issue 8787 - Better diagnostic on non-final interface function with a body
  • Loading branch information...
2 parents 6cfa082 + 185f279 commit 67ca915e3d89db564217bd6452de6c6799c01f6c @9rnsr 9rnsr committed Jan 13, 2013
Showing with 15 additions and 1 deletion.
  1. +1 −1 src/func.c
  2. +14 −0 test/fail_compilation/diag8787.d
View
2 src/func.c
@@ -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
View
14 test/fail_compilation/diag8787.d
@@ -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() {}

0 comments on commit 67ca915

Please sign in to comment.