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


--- Comment #0 from Jacob Carlborg <doob me.com> 2009-09-19 15:04:10 PDT ---
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


--- Comment #1 from strtr 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: -------
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


--- Comment #2 from Trass3r <mrmocool gmx.de> 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: -------
Jul 12 2011
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3332



--- Comment #3 from Trass3r <mrmocool gmx.de> 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: -------
Jul 16 2011
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3332



--- Comment #4 from Trass3r <mrmocool gmx.de> 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: -------
Jul 17 2011