Compiler complaining about ~ used on static array in @nogc fn

Shriramana Sharma via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Jan 13 08:53:17 PST 2016


Referring to: https://auto-tester.puremagic.com/show-run.ghtml?projectid=1&runid=1915054&isPull=true, the lines in question are 
phobos/std/utf.d (66, 67):

        UnsignedStringBuf buf = void;
        msg ~= " (at index " ~ unsignedToTempString(index, buf, 10) ~ ")";

rgrepping through the druntime and phobos sources for this symbol 
UnsignedStringBuf I found:

./druntime/src/core/internal/string.d:16:alias UnsignedStringBuf = char[20];

So if it's a static array, then it has nothing to do with the GC, and 
appending will not use the GC, right? So why is the compiler complaining 
that I cannot use ~ inside a @nogc function?

-- 
Shriramana Sharma, Penguin #395953


More information about the Digitalmars-d-learn mailing list