digitalmars.D.bugs - [Issue 16505] New: Enable nogc emplace
- via Digitalmars-d-bugs (33/33) Sep 17 2016 https://issues.dlang.org/show_bug.cgi?id=16505
https://issues.dlang.org/show_bug.cgi?id=16505 Issue ID: 16505 Summary: Enable nogc emplace Product: D Version: D2 Hardware: x86_64 OS: Linux Status: NEW Keywords: CTFE Severity: enhancement Priority: P1 Component: dmd Assignee: nobody puremagic.com Reporter: Marco.Leise gmx.de Phobos' emplace() cannot infer its attributes to include nogc, if the type's constructor cannot be run at compile-time. These two things are seemingly unrelated, but it boils down to how supporting emplace() at compile time makes use of language features that would be GC allocations at runtime: if (__ctfe) { […] // GC allocation at runtime: assert(0, "CTFE emplace doesn't support " ~ T.stringof ~ " from " ~ Args.stringof); } else { […] } If "if (__ctfe)" blocks were exempted from (runtime) attribute inference, it would work. A stop-gap-solution is to store the concatenation result in an enum. --
Sep 17 2016