[Issue 2521] Not possible to return immutable value by ref

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Dec 17 15:29:53 PST 2008


http://d.puremagic.com/issues/show_bug.cgi?id=2521


2korden at gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |INVALID




------- Comment #1 from 2korden at gmail.com  2008-12-17 17:29 -------
Immutable variables are not lvalues, you can't take address of them because
they might not present in a final executable. For example, everywhere you use
val, it is replaced with 23. You can't return 23 by reference, can you?

Besides, returning immutable values by mutable reference is disallowed:

func() = 42; //what should this do if func() returns reference to immutable
val?


-- 



More information about the Digitalmars-d-bugs mailing list