www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 3332] New: Mixin a constructor with a construct already present fails

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3332

           Summary: Mixin a constructor with a construct already present
                    fails
           Product: D
           Version: 1.047
          Platform: x86
        OS/Version: Mac OS X
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: doob me.com



The following code doesn't compile:

template C ()
{
    this (int i)
    {

    }
}

class A
{
    mixin C;

    this ()
    {

    }
}

void main ()
{
    auto a = new A(3);
}

The errors are: 
"main.d(23): Error: constructor main.A.this() does not match parameter types
(int)
main.d(23): Error: expected 0 arguments, not 1"

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Sep 19 2009
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3332


strtr despam.it changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |strtr despam.it



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: -------
May 18 2010
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3332


Trass3r <mrmocool gmx.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mrmocool gmx.de
           Platform|x86                         |All
            Version|1.047                       |D1 & D2
         OS/Version|Mac OS X                    |All



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: -------
Jul 12 2011
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3332




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: -------
Jul 16 2011
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3332




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: -------
Jul 17 2011