Thread overview
[Issue 8925] New: Constructor is called instead of opCall if constructor is generic
Nov 01, 2012
Malte Skarupke
Nov 01, 2012
Andrej Mitrovic
Nov 01, 2012
Malte Skarupke
Feb 10, 2013
Andrej Mitrovic
November 01, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8925

           Summary: Constructor is called instead of opCall if constructor
                    is generic
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: malteskarupke@web.de


--- Comment #0 from Malte Skarupke <malteskarupke@web.de> 2012-10-31 20:21:28 PDT ---
void main()
{
    struct S
    {
        this(T)(auto ref T t)
        {

        }

        void opCall(int i)
        {
            x = i;
        }
        int x;
    }

    S s;
    s(5);
    assert(s.x == 5);
}

That assert will fail in DMD 2.060 because the line s(5) will actually call the
constructor.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
November 01, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8925


Andrej Mitrovic <andrej.mitrovich@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |andrej.mitrovich@gmail.com


--- Comment #1 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2012-10-31 20:40:18 PDT ---
Seems to work ok in Git head, I don't know which pull fixed it.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
November 01, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8925



--- Comment #2 from Malte Skarupke <malteskarupke@web.de> 2012-10-31 20:51:35 PDT ---
It may actually have been this one: http://d.puremagic.com/issues/show_bug.cgi?id=6036

(Which is marked as fixed, even though it clearly still doesn't work until there is a new version of DMD)

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
February 10, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=8925


Andrej Mitrovic <andrej.mitrovich@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |WORKSFORME


--- Comment #3 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2013-02-09 22:29:13 PST ---
Fixed in 2.061.

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