[Issue 11455] New: Overriding template methods should raise a compile error
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Wed Nov 6 08:37:56 PST 2013
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: nobody at puremagic.com
ReportedBy: david.eckardt at sociomantic.com
--- Comment #0 from David Eckardt <david.eckardt at sociomantic.com> 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: -------
More information about the Digitalmars-d-bugs
mailing list