D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 8030 - Multiple override are allowed using mixin template
Summary: Multiple override are allowed using mixin template
Status: NEW
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P3 normal
Assignee: No Owner
URL:
Keywords: accepts-invalid
Depends on:
Blocks:
 
Reported: 2012-05-04 02:33 UTC by Denis Shelomovskii
Modified: 2024-12-13 17:59 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Denis Shelomovskii 2012-05-04 02:33:36 UTC
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 Denis Shelomovskii 2012-05-04 04:48:06 UTC
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 andy-hanson 2016-04-10 00:10:58 UTC
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 dlangBugzillaToGithub 2024-12-13 17:59:45 UTC
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