www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 13655] New: clarify that a ref parameter cannot bind to an

https://issues.dlang.org/show_bug.cgi?id=13655

          Issue ID: 13655
           Summary: clarify that a ref parameter cannot bind to an rvalue
           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:

ref int foo(ref int x) { return x ; }
void main () { foo(3) ; }

produces the error message:

"function rvalue_argument.foo (ref int x) is not callable using argument types
(int)"

It would be more meaningful if this could be clarified on the lines of:

"argument ref int x of function rvalue_argument.foo cannot bind to an rvalue"

--
Oct 25 2014