[Issue 8663] New: AliasThis is not used in comparison
    d-bugmail at puremagic.com 
    d-bugmail at puremagic.com
       
    Sat Sep 15 04:47:08 PDT 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 at metalanguage.com
        ReportedBy: szadows at gmail.com
--- Comment #0 from Robik <szadows at 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: -------
    
    
More information about the Digitalmars-d-bugs
mailing list