https://d.puremagic.com/issues/show_bug.cgi?id=11455
Summary: Overriding template methods should raise a compile
error
Product: D
Version: D1 & D2
Platform: All
OS/Version: All
Status: NEW
Severity: normal
Priority: P2
Component: DMD
AssignedTo: [email protected]
ReportedBy: [email protected]
--- Comment #0 from David Eckardt <[email protected]> 2013-11-06
08:37:53 PST ---
The "override" keyword can be applied to template methods but they don't
actually override. Consider the following example:
---
module tmpoverr;
class A
{
int f(T)(T t) {return 47;}
}
class B : A
{
override int f(T)(T t) {return 11;}
}
void main ( )
{
A b = new B;
assert(b.f(0) == 47); // passes: A.f() called, not B.f()
assert(b.f(0) == 11); // fails for the same reason
}
---
It should be a compile error error to use the "override" keyword with a
template method.
--
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------