www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 13656] New: clarify error message upon trying to declare a


          Issue ID: 13656
           Summary: clarify error message upon trying to declare a
                    variable of type ref
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Keywords: diagnostic
          Severity: enhancement
          Priority: P1
         Component: DMD
          Assignee: nobody puremagic.com
          Reporter: samjnaa gmail.com

Hello. The following code:

void main () {
    int i ;
    ref ir = i ;

produces the following error message:

"variable ref_type.main.ir only parameters or foreach declarations can be ref"

The sentence is unclear "variable x only ... can be ref". What is meant is
"Attempt to declare variable of type ref". Please clarify this.

Also, please add ", return values" after "parameters" in the above error
message since code like:

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

is permitted.

Oct 25 2014