Bug 8030 – Multiple override are allowed using mixin template

Status
NEW
Severity
normal
Priority
P3
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2012-05-04T02:33:36Z
Last change time
2024-12-13T17:59:45Z
Keywords
accepts-invalid
Assigned to
No Owner
Creator
Denis Shelomovskii
Moved to GitHub: dmd#18436 →

Comments

Comment #0 by verylonglogin.reg — 2012-05-04T02:33:36Z
IMHO this should rise a compiler error: --- mixin template T() { override string f() { return "T"; } } class A { string f() { return "A"; } } class B: A { mixin T; override string f() { return "B"; } mixin T; } void main() { A b = new B; assert(b.f() == "B"); // This passes } ---
Comment #1 by verylonglogin.reg — 2012-05-04T04:48:06Z
Or, if this shouldn't rise an error, this also should compiles: --- class B: A { mixin T; mixin T; override string f() { return "B"; } } --- Error: function main.B.T!().f multiple overrides of same function
Comment #2 by andy-hanson — 2016-04-10T00:10:58Z
Related: overloads don't appear to be recognized from within mixin templates. --- class X { void x() {} mixin template T() { void x(int y) { x(); } } mixin T; } // app.d(4): Error: function app.X.T!().x (int y) is not callable using argument types ()
Comment #3 by robert.schadek — 2024-12-13T17:59:45Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/18436 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB