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

          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: nob...@puremagic.com
          Reporter: bugzi...@digitalmars.com

The following fails:

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

with:

  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
unnecessary.

This problem was introduced by a fix to:

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

and change:

  https://github.com/dlang/dmd/commit/e64ae1d3e5aa078a036242864a68499617c9b278

--

Reply via email to