Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions compiler/src/dmd/parse.d
Original file line number Diff line number Diff line change
Expand Up @@ -4611,6 +4611,13 @@ class Parser(AST, Lexer = dmd.lexer.Lexer) : Lexer
*/
if (tpl)
{
// @@@DEPRECATED_2.114@@@
// Both deprecated in 2.104, change to error
if (storage_class & STC.override_)
deprecation(loc, "a function template is not virtual so cannot be marked `override`");
else if (storage_class & STC.abstract_)
deprecation(loc, "a function template is not virtual so cannot be marked `abstract`");

// Wrap a template around the function declaration
auto decldefs = new AST.Dsymbols();
decldefs.push(s);
Expand Down
18 changes: 18 additions & 0 deletions compiler/test/fail_compilation/template_function_oop.d
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/*
REQUIRED_ARGS: -de
TEST_OUTPUT:
---
fail_compilation/template_function_oop.d(16): Deprecation: a function template is not virtual so cannot be marked `override`
fail_compilation/template_function_oop.d(17): Deprecation: a function template is not virtual so cannot be marked `abstract`
---
*/
class C
{
void f();
}

class D : C
{
override void f()() {}
abstract void g()();
}