www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 16747] New: Cannot have stack allocated classes in safe code


          Issue ID: 16747
           Summary: Cannot have stack allocated classes in  safe code
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: regression
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: bugzilla digitalmars.com

The following fails:

  void foo()  safe {
    scope o = new Object();


  Error: delete o is not  safe but is used in  safe function foo

because o is allocated on the stack and the destructor gets called. But in this
case there is no destructor, and no deallocation, so the unsafe delete call is

This problem was introduced by a fix to:


and change:


Nov 24 2016