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

Max Samukha <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |[email protected]

--- Comment #1 from Max Samukha <[email protected]> ---
Assigning to an array's length may reallocate, and allocation still needs
TypeInfo. You could try to get away with a lambda (not tested):

alias _ctfeAppend = (store, dat)
{
        alias T = typeof(dat);

        static if (is(T U: const(U)))
        {
            pragma(msg, U);
                U[] buf;
                buf.length = 1;
                buf[0] = dat;
                store = cast(T[])buf;
        }
};

However, the lambda hack is unusable for anything slightly less trivial (no
overloading, if-constraints, variadic parameters, etc.)

--

Reply via email to