[Issue 13381] Two cases of array literal that can be stack-allocated

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Tue Sep 16 03:00:37 PDT 2014


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

bearophile_hugs at eml.cc changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|One case of array literal   |Two cases of array literal
                   |that can be stack-allocated |that can be stack-allocated

--- Comment #12 from bearophile_hugs at eml.cc ---
Another case worth optimizing:


void main() @nogc {
    import std.traits: EnumMembers;
    enum Foo { A, B, C, D }
    size_t i = 2;
    Foo[4] foos = [EnumMembers!Foo]; // OK
    auto r1 = foos[i];
    auto r2 = [EnumMembers!Foo][i]; // Error: array literal in @nogc
}

--


More information about the Digitalmars-d-bugs mailing list