Summary: [CTFE] wrong error "value used before set" when
                    slicing =void array
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Severity: major
          Priority: P2
         Component: DMD

--- Comment #0 from Dmitry Olshansky <> 2011-08-05 
03:00:04 PDT ---
void fillWithZero(T)(T[] arr)
    foreach(ref x; arr)
        x = 0;

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

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

Fails with:
bug6XXX.d(11): Error: variable stackSpace is used before initialization
bug6XXX.d(11): Error: cannot evaluate fillWithZero(stackSpace[]) at compile
bug6XXX.d(16): Error: cannot evaluate f() at compile time
bug6XXX.d(16): Error: static assert  (cast(int[])f() == [0,0,0,0]) is not
evaluatable at compile time

It's CTFE only issue and is a blocker for one overload of phobos insertInPlace.

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

Reply via email to