https://issues.dlang.org/show_bug.cgi?id=13656
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: [email protected]
Reporter: [email protected]
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.
--