www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 21709] New: std.conv.emplace not usable in betterC - 2.096 beta


          Issue ID: 21709
           Summary: std.conv.emplace not usable in betterC - 2.096 beta
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: regression
          Priority: P1
         Component: druntime
          Assignee: nobody puremagic.com
          Reporter: mmcomando gmail.com

Our CI updated to dmd 2.096 and this error showed up:
Error: Cannot use try-catch statements with -betterC
Error: template instance `core.internal.lifetime.emplaceRef!(EntityManager,
EntityManager, uint, uint, uint).emplaceRef.S.__ctor!()` error instantiating

CI job url:

From error message it seems that core.internal.lifetime.emplaceRef uses
try-catch statement which is not supported by -betterC. I have tried to look for the code on github but I have not found lines with try-catch in druntime/import/core/internal/lifetime.d(35,13) so I am not sure if try-catch is the problem. Part of our code which uses emplace: static T* make(T, Args...)(Args args) { T* ret = cast(T*) malloc(T.sizeof); static import std.conv; static if (__traits(isPOD, T)) { __gshared immutable T init = T.init; memcpy(ret, &init, T.sizeof); } else static if (is(T == struct)) std.conv.emplace(ret, args); return ret; } --
Mar 13 2021