www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Two cases for improving error messages

reply Shriramana Sharma via Digitalmars-d-learn writes:
Hello. Please see the following and say whether they're OK to submit
as bugs for improving the error messages. Thanks.

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: add ", return values" after "parameters"
}


-- 
Shriramana Sharma ஶ்ரீரமணஶர்மா
श्रीरमणशर्मा
Oct 25 2014
next sibling parent "bearophile" <bearophileHUGS lycos.com> writes:
Shriramana Sharma:

     int i ;
     ref ir = i ;
 // Error: variable ref_type.main.ir only parameters or foreach
 declarations can be ref
 // Comment: add ", return values" after "parameters"
 }
I like this. Bye, bearophile
Oct 25 2014
prev sibling parent Steven Schveighoffer <schveiguy yahoo.com> writes:
On 10/25/14 7:44 AM, Shriramana Sharma via Digitalmars-d-learn wrote:
 Hello. Please see the following and say whether they're OK to submit
 as bugs for improving the error messages. Thanks.

 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: add ", return values" after "parameters"
 }
I think both are clearer, please submit bugs! BTW, don't be shy about submitting bugs, most of the devs watch the bug list and pick up on things that are just not going to happen. Worst case is that your bug just gets closed as wontfix. -Steve
Oct 25 2014