The following code does not compile char[] unsignedToTempString(uint radix = 10)(ulong value, return scope char[] buf) @safe if (radix >= 2 && radix <= 16) { size_t i = buf.length; do { uint x = void; if (value < radix) { x = cast(uint)value; value = 0; } else { x = cast(uint)(value % radix); value /= radix; } buf[--i] = cast(char)((radix <= 10 || x < 10) ? x + '0' : x - 10 + 'a'); } while (value); return buf[i .. $]; } char[] myToString(ulong n) { char[20] buf; auto s = unsignedToTempString(n, buf); return s ~ (n > uint.max ? "UL" : "U"); } enum a = myToString(5); Fails with Error: array concatenation of expression `cast(const(char)[])s ~ (n > 4294967295LU ? "UL" : "U")` requires the GC which is not available with -betterC
I should note that this is a bug in master
This is not a bug. You are compiling with -betterC so code needs to be generated for `myToString`. That code ends up in the object file and may be linked at some point, therefore the compiler tells you that you are compiling with -betterC which means that you cannot use functions from druntime (the array concat hook). If you template the myToString method then the code compiles successfully because the template instances do not make it to the object file.
(In reply to RazvanN from comment #2) > If you template the myToString method then the code compiles successfully > because the template instances do not make it to the object file. I'm going to open an error message bug then. There's no way a normal user is going to know this.