Don <> changed:

           What    |Removed                     |Added
                 CC|                            |

--- Comment #1 from Don <> 2011-08-05 23:43:35 PDT ---
That's difficult. Implementing this would be a major feature, since assignment
from void has a high risk of undefined behaviour.

The f() function is passing a reference to an uninitialized value, to another
function. In this particular case, it does initialize every member without
reading from any of them, but that's difficult to determine.
I guess it could be implemented by introducing an 'uninitialized expression',
but then there are problems with this:

void fillWithZero(T)(T[] arr)
    auto q = arr[0];   // consider this line
    foreach(ref x; arr)
        x = 0;

T[4] f(T)()
    T[4] stackSpace = void;
    return stackSpace;

static assert(f!int() == [0,0,0,0]); 

The assignment to q should generate a 'variable used before set' error. But to
be comprehensible, it should also refer to the line where stackSpace was

Configure issuemail:
------- You are receiving this mail because: -------

Reply via email to