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

           Summary: compiler attempts to call ctor instead of opCall
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nob...@puremagic.com
        ReportedBy: andrej.mitrov...@gmail.com


--- Comment #0 from Andrej Mitrovic <andrej.mitrov...@gmail.com> 2012-09-17 
07:31:40 PDT ---
struct Foo
{
    this(int) {}

    bool opCall(string)
    {
        return true;
    }
}

void main()
{
    Foo foo = Foo(1);
    if (foo("a")) { }  // error
}

test.d(17): Error: constructor test.Foo.this (int _param_0) is not callable
using argument types (string)
test.d(17): Error: cannot implicitly convert expression ("a") of type string to
int

The compiler has no business calling a ctor on a variable invocation.

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

Reply via email to