[Issue 8925] New: Constructor is called instead of opCall if constructor is generic

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Oct 31 20:21:29 PDT 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 at puremagic.com
        ReportedBy: malteskarupke at web.de


--- Comment #0 from Malte Skarupke <malteskarupke at 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: -------


More information about the Digitalmars-d-bugs mailing list