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

           Summary: std.typecons.Proxy incorrectly allows implicit
                    conversion to class
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: accepts-invalid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nob...@puremagic.com
        ReportedBy: k.hara...@gmail.com


--- Comment #0 from Kenji Hara <k.hara...@gmail.com> 2012-03-03 22:11:32 PST ---
import std.typecons;
void main()
{
    class C {}
    auto a = Typedef!C(new C);
    C b = a;   // accepts-invalid
}


This is a dmd bug, because opBinaryRight runs unexpectedly.
Reduced test case:

mixin template Proxy(alias a)
{
    auto ref opBinaryRight(string op, B)(auto ref B b)
    {
        return mixin("b "~op~" a");
    }
}
struct Typedef(T)
{
    private T Typedef_payload;

    this(T init)
    {
        Typedef_payload = init;
    }

    mixin Proxy!Typedef_payload;
}
void main()
{
    class C {}
    C c1 = new C();
    auto a = Typedef!C(c1);
    C c2 = a;
}

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

Reply via email to