www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 16505] New: Enable nogc emplace


          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);

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

Sep 17 2016