[Issue 8228] Mixin template can't add constructor to class

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Aug 21 15:16:44 PDT 2013


http://d.puremagic.com/issues/show_bug.cgi?id=8228


John Colvin <john.loughran.colvin at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |john.loughran.colvin at gmail.
                   |                            |com


--- Comment #1 from John Colvin <john.loughran.colvin at gmail.com> 2013-08-21 23:16:42 BST ---
(In reply to comment #0)
> mixin template Root()
> {
>     this(int x) { }
>     void test() { }
> }
> 
> class Foo
> {
>     mixin Root;
>     this()
>     {
>         test();   // OK
>         this(1);  // FAIL
>     }
> }
> 
> void main() { }
> 
> It's ok to add virtual methods but not constructors. This has to be a bug..

sadly, it's not a bug. template mixins create a scope and there's no overload
resolution between it and it's enclosing scope.


We should really have a way of doing a full mixin without resorting to strings.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list