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

           Summary: Should be possible to pass struct function returns by
                    'const ref'.
           Product: D
           Version: D2
          Platform: Other
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nob...@puremagic.com
        ReportedBy: clugd...@yahoo.com.au


--- Comment #0 from Don <clugd...@yahoo.com.au> 2011-06-29 01:31:54 PDT ---
struct S6221 {
    int num;    
}

S6221 blah6221()
{
    return S6221(1);
}

void boo6221(const ref S6221 rhs) {}

void bug6221()
{
    boo6221(blah6221()); // fails; not callable with argument types S6221
}

This is a particular problem because of opCmp:

struct S
{
    int num;    
    int opCmp(const ref S rhs) const
    {
        if (num < rhs.num)
            return -1;
        else if (num > rhs.num)
            return 1;
        return 0;
    }
}

S blah() {
    return S(1);
}

void bug()
{
    bool b1 = blah() < S(45); // OK
    bool b2 = S(45) > blah(); // fails
}

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

Reply via email to