www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 12019] New: Better error message for refused ref function argument

https://d.puremagic.com/issues/show_bug.cgi?id=12019

           Summary: Better error message for refused ref function argument
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: diagnostic
          Severity: enhancement
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: bearophile_hugs eml.cc


--- Comment #0 from bearophile_hugs eml.cc 2014-01-28 08:50:22 PST ---
This is wrong code:


void foo(ref int[1] b) {}
void main() {
    ubyte[4] a;
    foo(cast(int[1])a);
}


dmd 2.065beta gives correctly an error message:

test.d(4): Error: function test.foo (ref int[1] b) is not callable using 
argument types (int[1])


But I'd like the error message to explain why it can't compile, that it can't
be accepted by reference. Something like:

test.d(4): Error: function test.foo (ref int[1] b) is not callable using
argument types cast(int[1]) because it is not an lvalue

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