Thread overview
[Issue 7641] New: std.typecons.Proxy incorrectly allows implicit conversion to class
Mar 04, 2012
Kenji Hara
Mar 04, 2012
Kenji Hara
Mar 10, 2012
Walter Bright
Mar 28, 2012
Kenji Hara
Mar 28, 2012
Kenji Hara
March 04, 2012
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: nobody@puremagic.com
        ReportedBy: k.hara.pg@gmail.com


--- Comment #0 from Kenji Hara <k.hara.pg@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: -------
March 04, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7641


Kenji Hara <k.hara.pg@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull


--- Comment #1 from Kenji Hara <k.hara.pg@gmail.com> 2012-03-03 22:22:09 PST ---
https://github.com/D-Programming-Language/dmd/pull/780

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



--- Comment #2 from github-bugzilla@puremagic.com 2012-03-10 00:45:06 PST ---
Commit pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/368d966cb0efd1b326d9ac6a5879f96864f92416 Merge pull request #780 from 9rnsr/fix7641

fix Issue 7641 - std.typecons.Proxy incorrectly allows implicit conversion to class

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


Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bugzilla@digitalmars.com
         Resolution|                            |FIXED


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


Kenji Hara <k.hara.pg@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Version|D2                          |D1 & D2


--- Comment #3 from Kenji Hara <k.hara.pg@gmail.com> 2012-03-27 17:40:04 PDT ---
D1 branch was fixed by the commit:

https://github.com/D-Programming-Language/dmd/commit/6234c1d15b8cdf9021789fdd90730f6c650fd5af merge D2 pull #780

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


Kenji Hara <k.hara.pg@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |samukha@voliacable.com


--- Comment #4 from Kenji Hara <k.hara.pg@gmail.com> 2012-03-27 17:40:39 PDT ---
*** Issue 671 has been marked as a duplicate of this issue. ***

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