D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 19729 - Constructor overloads coming from mixin are not resolved
Summary: Constructor overloads coming from mixin are not resolved
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P1 normal
Assignee: No Owner
URL:
Keywords: pull, rejects-valid
Depends on:
Blocks:
 
Reported: 2019-03-10 23:23 UTC by basile-z
Modified: 2020-09-04 13:16 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 basile-z 2019-03-10 23:23:41 UTC
While this work:

---
mixin template Templ(T) {
    void foo(T) {}
}

class C {
    mixin Templ!int;
    mixin Templ!string;
}

void main() {
    auto c = new C;
    c.foo("should work");
}  
---

This does not:

---
mixin template Templ(T) {
    this(T) {}
}

class C {
    mixin Templ!int;
    mixin Templ!string;
}

void main() {
    auto c = new C("should work");
}
--- 

And fails with a bad error message:  

> Error: overloadset `bn.C.__ctor` is aliased to a function
Comment 1 elpenguino+D 2019-03-10 23:29:11 UTC
This looks pretty similar to https://issues.dlang.org/show_bug.cgi?id=11500
Comment 2 basile-z 2019-03-10 23:41:44 UTC
Sorry i should have precised that the bug will only start existing once https://issues.dlang.org/show_bug.cgi?id=17259 fixed. Which will come in a neat future. For now it's still an ICE. I'll see later if this is the same as 11500.
Comment 3 Dlang Bot 2020-08-30 11:43:05 UTC
@NilsLankila created dlang/dmd pull request #11652 "fix issue 19729 - Constructor overloads coming from mixin are not resolved" fixing this issue:

- fix issue 19729 - Constructor overloads coming from mixin are not resolved
  
  The test _b17259.d_ was created to check that an ICE was fixed but then this became a reject-valid.
  Make it working for good this time.

https://github.com/dlang/dmd/pull/11652
Comment 4 Dlang Bot 2020-09-04 13:16:50 UTC
dlang/dmd pull request #11652 "fix issue 19729 - Constructor overloads coming from mixin are not resolved" was merged into master:

- 45656385de8b9f443941a260ae0a4cee253e6c78 by Nils Lankila:
  fix issue 19729 - Constructor overloads coming from mixin are not resolved
  
  The test _b17259.d_ was created to check that an ICE was fixed but then this became a reject-valid.
  Make it working for good this time.

https://github.com/dlang/dmd/pull/11652