[Issue 3332] Mixin a constructor with a construct already present fails
https://issues.dlang.org/show_bug.cgi?id=3332 RazvanN changed: What|Removed |Added CC||yshu...@gmail.com --- Comment #14 from RazvanN --- *** Issue 19795 has been marked as a duplicate of this issue. *** --
[Issue 3332] Mixin a constructor with a construct already present fails
https://issues.dlang.org/show_bug.cgi?id=3332 Iain Buclaw changed: What|Removed |Added Priority|P2 |P3 --
[Issue 3332] Mixin a constructor with a construct already present fails
https://issues.dlang.org/show_bug.cgi?id=3332 Dlang Bot changed: What|Removed |Added Keywords||pull --- Comment #13 from Dlang Bot --- @RazvanN7 created dlang/dmd pull request #14644 "Fix Issue 3332 - Mixin a constructor with a construct already present fails" fixing this issue: - Fix Issue 3332 - Mixin a constructor with a construct already present fails https://github.com/dlang/dmd/pull/14644 --
[Issue 3332] Mixin a constructor with a construct already present fails
https://issues.dlang.org/show_bug.cgi?id=3332 --- Comment #12 from RazvanN --- (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. --
[Issue 3332] Mixin a constructor with a construct already present fails
https://issues.dlang.org/show_bug.cgi?id=3332 Simen Kjaeraas changed: What|Removed |Added CC||andrej.mitrov...@gmail.com --- Comment #11 from Simen Kjaeraas --- *** Issue 8228 has been marked as a duplicate of this issue. *** --
[Issue 3332] Mixin a constructor with a construct already present fails
https://issues.dlang.org/show_bug.cgi?id=3332 Simen Kjaeraas changed: What|Removed |Added CC||ralph.ba...@gmail.com --- Comment #10 from Simen Kjaeraas --- *** Issue 17055 has been marked as a duplicate of this issue. *** --
[Issue 3332] Mixin a constructor with a construct already present fails
https://issues.dlang.org/show_bug.cgi?id=3332 Simen Kjaeraas changed: What|Removed |Added CC||rob...@octarineparrot.com --- Comment #9 from Simen Kjaeraas --- *** Issue 7206 has been marked as a duplicate of this issue. *** --
[Issue 3332] Mixin a constructor with a construct already present fails
https://issues.dlang.org/show_bug.cgi?id=3332 RazvanN changed: What|Removed |Added CC||razvan.nitu1...@gmail.com --- Comment #8 from RazvanN --- For a normal function, the mixin can be named as explicitly inserted in the overload set: template C () { void fun(int i) { } } class A { mixin C f; alias fun = f.fun; void fun () { } } void main () { auto a = new A(); a.fun(); } However, for constructors you cannot do that since you do not have a name. I tried using __ctor: template C () { this (int i) { ยทยทยท } } class A { mixin C f; alias __ctor = f.__ctor; // alias `test.A.__ctor` is not a // constructor; identifiers starting // with `__` are reserved for the implementation this () { } } void main () { auto a = new A(3); } But get the above mentioned error. The solution would be to allow the usage of __ctor in this situation. --
[Issue 3332] Mixin a constructor with a construct already present fails
https://issues.dlang.org/show_bug.cgi?id=3332 Andrei Alexandrescu changed: What|Removed |Added Version|D1 & D2 |D2 --
[Issue 3332] Mixin a constructor with a construct already present fails
https://issues.dlang.org/show_bug.cgi?id=3332 Vlad Levenfeld changed: What|Removed |Added CC||vlevenf...@gmail.com --
[Issue 3332] Mixin a constructor with a construct already present fails
https://issues.dlang.org/show_bug.cgi?id=3332 --- Comment #7 from Vlad Levenfeld --- This one bit me recently as well. I also think it would be handy to be able to control a mixin's interaction with the overload set. I have a case where I'd like to add a specialization to a mixed-in constructor set. --
[Issue 3332] Mixin a constructor with a construct already present fails
https://d.puremagic.com/issues/show_bug.cgi?id=3332 --- Comment #6 from Jacob Carlborg 2014-02-25 12:00:01 PST --- 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. -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 3332] Mixin a constructor with a construct already present fails
https://d.puremagic.com/issues/show_bug.cgi?id=3332 Adam D. Ruppe changed: What|Removed |Added CC||destructiona...@gmail.com --- Comment #5 from Adam D. Ruppe 2014-02-25 10:50:38 PST --- I'm not sure this is a bug, and I'd be weary of any fix for it because this comes from an extremely useful feature of template mixins. Any name in the class overrides the same name from the template mixin. This is useful because it allows for easy customization of a single function from an otherwise very useful mixin. Kinda like inheriting from a class and just overriding one function, very good ability to have. But since it is the *name*, if you override one, it blasts the entire overload set. Here, you did your own constructor, so all overloaded constructors are considered overridden. I'm not sure if you can just alias in the mixin template's functions to add them to the set. So I kinda wish you could change just one overload so this might be a bug, but overriding a function like this is a useful, documented feature of template mixins so it might not be and either way, caution is needed not to flush the baby with the bathwater. -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 3332] Mixin a constructor with a construct already present fails
http://d.puremagic.com/issues/show_bug.cgi?id=3332 --- Comment #4 from Trass3r 2011-07-17 12:56:58 PDT --- This could probably be fixed in TemplateMixin::semantic: // Add members to enclosing scope, as well as this scope for (unsigned i = 0; i < members->dim; i++) { Dsymbol *s; s = members->tdata()[i]; s->addMember(argscope, this, i); + // need to do some sort of checking here + // if (s->isFuncDeclaration()) //sc->insert(s); <-- -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 3332] Mixin a constructor with a construct already present fails
http://d.puremagic.com/issues/show_bug.cgi?id=3332 --- Comment #3 from Trass3r 2011-07-16 10:13:57 PDT --- This is not limited to constructors. Overload resolution doesn't work for any method. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 3332] Mixin a constructor with a construct already present fails
http://d.puremagic.com/issues/show_bug.cgi?id=3332 Trass3r changed: What|Removed |Added CC||mrmoc...@gmx.de Platform|x86 |All Version|1.047 |D1 & D2 OS/Version|Mac OS X|All --- Comment #2 from Trass3r 2011-07-12 06:13:14 PDT --- Also fails on 2.054, Linux x64 test.d(21): Error: constructor test.A.this () is not callable using argument types (int) test.d(21): Error: expected 0 arguments, not 1 for non-variadic function type A() -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 3332] Mixin a constructor with a construct already present fails
http://d.puremagic.com/issues/show_bug.cgi?id=3332 st...@despam.it changed: What|Removed |Added CC||st...@despam.it --- Comment #1 from st...@despam.it 2010-05-18 15:53:06 PDT --- This one bit me as well today :( Windows D1.061 Hack: renamed all constructors within the mixin to ctor. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---