www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 20650] New: Cryptic error message when GC called in finalizer

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

          Issue ID: 20650
           Summary: Cryptic error message when GC called in finalizer
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: druntime
          Assignee: nobody puremagic.com
          Reporter: default_357-line yahoo.de

Consider the following code:

class Foo { ~this() { new int; } }
void main() { new Foo; }

What I expected:

core.exception.ReentrantFinalizerException: GC called while finalizing memory.
Are your destructors  nogc?

What I got:

core.exception.InvalidMemoryOperationError src/core/exception.d(647): Invalid
memory operation

This is cryptic at best and actively misleading at worst, due to the confusion
potential with segfaults. The error message should be made clearer.

--
Mar 09