Error message clarity w.r.t. ref

Shriramana Sharma via Digitalmars-d digitalmars-d at puremagic.com
Fri Oct 16 03:12:46 PDT 2015


ref int foo(ref int x) { return x ; }

void main ()
{
    foo(3) ;
// Error: function rvalue_argument.foo (ref int x) is not callable using 
argument types (int)
// Comment: "argument ref int x of function rvalue_argument.foo cannot bind 
to an rvalue" would be clearer IMO

    int i ;
    ref ir = i ;
// Error: variable ref_type.main.ir only parameters or foreach declarations 
can be ref
// Comment: after the variable name add a colon, and add ", return values" 
after "parameters"
}

NOTE: Not creating pull request or bugzilla since procedure much more 
tortuous than posting to NG. (Sorry but I'm still catching up on lots of 
pending projects right now so...)

-- 
Shriramana Sharma, Penguin #395953


More information about the Digitalmars-d mailing list