www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 17297] New: Object.~this not being nogc is severely limiting

https://issues.dlang.org/show_bug.cgi?id=17297

          Issue ID: 17297
           Summary: Object.~this not being  nogc is severely limiting
                     nogc applicability
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: druntime
          Assignee: nobody puremagic.com
          Reporter: aliloko gmail.com

destroy() infers it's " nogc"-ness from rt_finalize which is not nothrow
and not  nogc:
https://github.com/dlang/druntime/blob/5a94816c8f1d5c225e560151cebe0a09949896a5/src/object.d#L16


I guess the rationale is that rt_finalize call Object.~this() and that
may GC allocate, and throw.

In turn this cause every wrapper using emplace+destroy to not be  nogc.

Current programs which run without the runtime must currently break the type
system in order to call destroy() anyway.

https://www.auburnsounds.com/blog/2016-11-10_Running-D-without-its-runtime.html

--
Apr 04