Bug 3472 – alias of a template cannot be used to override a function required by an interface

Status
NEW
Severity
normal
Priority
P3
Component
dmd
Product
D
Version
D1 (retired)
Platform
Other
OS
Mac OS X
Creation time
2009-11-04T08:00:32Z
Last change time
2024-12-13T17:50:53Z
Keywords
rejects-valid
Assigned to
No Owner
Creator
Fawzi Mohamed
See also
https://issues.dlang.org/show_bug.cgi?id=2683
Moved to GitHub: dmd#18128 →

Comments

Comment #0 by fawzi — 2009-11-04T08:00:32Z
The following shows that alias cannot be used to override a function that is requested by an interface. luckily the mixin does work, but I think that also the alias version should work... (I find it cleaner) I tested both in D1 and D2. {{{ interface II{ void f(int); void f(double); } template pr(T){ void f(T i){ // do something } } class A:II{ void print(T)(T i){ // do something } version(works){ mixin pr!(int); mixin pr!(double); } else { // fails alias print!(int) f; alias print!(double) f; } } }}}
Comment #1 by fawzi — 2009-11-04T08:25:54Z
For completness I forgot to say that also {{{ alias print!(int).print f; }}} does not work, and with the mixin to *really* have it working you need the mixin (that mixes in the things with the correct name to remove the interface error), and alias (to make overloading actually work). Definitely ugly
Comment #2 by robert.schadek — 2024-12-13T17:50:53Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/18128 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB