Thread overview
[Issue 8663] New: AliasThis is not used in comparison
Sep 15, 2012
Robik
Sep 15, 2012
Robik
Jan 02, 2013
yebblies
September 15, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8663

           Summary: AliasThis is not used in comparison
           Product: D
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: ASSIGNED
          Severity: normal
          Priority: P2
         Component: druntime
        AssignedTo: andrei@metalanguage.com
        ReportedBy: szadows@gmail.com


--- Comment #0 from Robik <szadows@gmail.com> 2012-09-15 04:48:04 PDT ---
Demo: http://dpaste.dzfl.pl/72015697

Test case:
import std.stdio;

void main()
{
    C c = new C("foo");
    writeln(c == "foo");
}

class C
{
    string v;

    // This does not work
    alias v this;

    this(string val) { v = val; }
}

Result:
testcase.d(8): Error: function object.Object.opEquals (Object lhs, Object rhs)
is not callable using argument types (string)
testcase.d(8): Error: expected 2 function arguments, not 1

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



--- Comment #1 from Robik <szadows@gmail.com> 2012-09-15 07:12:21 PDT ---
Also concerns opCmp.

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


yebblies <yebblies@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |yebblies@gmail.com
          Component|druntime                    |DMD
            Version|unspecified                 |D2
         AssignedTo|andrei@metalanguage.com     |nobody@puremagic.com


--- Comment #2 from yebblies <yebblies@gmail.com> 2013-01-02 18:15:23 EST ---
This is a dmd issue.  Assigning to the alias this expert.

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