[Issue 3332] Mixin a constructor with a construct already present fails
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Wed Nov 16 09:41:41 UTC 2022
https://issues.dlang.org/show_bug.cgi?id=3332
--- Comment #12 from RazvanN <razvan.nitu1305 at gmail.com> ---
(In reply to Jacob Carlborg from comment #6)
> I might not have really understood how mixins worked back when I reported
> this issue so it might not be an issue.
>
> There is one problem with this though. As far as I know you cannot alias a
> constructor to bring the two constructors to the same overload set.
There is a workaround:
template C ()
{
this (int i)
{
}
}
class A
{
mixin C f;
this ()
{
}
alias __ctor = f.__ctor;
}
void main ()
{
auto a = new A(3);
}
It seems that the __ctor alias works only if the symbol is already defined.
--
More information about the Digitalmars-d-bugs
mailing list