Skip to content

Commit

Permalink
Fix Issue 17586 - Overriding a deprecated base class function gives n…
Browse files Browse the repository at this point in the history
…o warning
  • Loading branch information
RazvanN7 committed Nov 14, 2017
1 parent 03e806a commit 1ae083f
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/ddmd/dsymbolsem.d
Expand Up @@ -4567,6 +4567,10 @@ private extern(C++) final class DsymbolSemanticVisitor : Visitor
goto Lintro;
}

if (fdv.isDeprecated)
deprecation(funcdecl.loc, "`%s` is overriding the deprecated method `%s`",
funcdecl.toPrettyChars, fdv.toPrettyChars);

// This function overrides fdv
if (fdv.isFinalFunc())
funcdecl.error("cannot override final function %s", fdv.toPrettyChars());
Expand Down
14 changes: 14 additions & 0 deletions test/fail_compilation/test17586.d
@@ -0,0 +1,14 @@
/* REQUIRED_ARGS: -o- -de
TEST_OUTPUT:
---
fail_compilation/test17586.d(13): Deprecation: `test17586.D.foo` is overriding the deprecated method `test17586.C.foo`
---
*/

class C{
deprecated void foo(){}
}

class D : C{
override void foo(){}
}

0 comments on commit 1ae083f

Please sign in to comment.