[Issue 15632] New: Calling delete on scope class should be an error?

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Sun Jan 31 07:11:36 PST 2016


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

          Issue ID: 15632
           Summary: Calling delete on scope class should be an error?
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: ibuclaw at gdcproject.org

Example:
---
void f()
{
    scope A a = new A();
    delete a;
}
---

Produces the following codegen, which is not entirely desirable.
---
void f()
{
  A a = A.init;
  __ctor (&a);

  _d_callfinalizer (a);
  _d_callfinalizer (a);  // Call always inserted by the compiler.
}
---

See here for when it came up.

https://github.com/D-Programming-Language/dmd/pull/4860/files#diff-59055e7d57cf8be77c7e30104955e8fdL640

--


More information about the Digitalmars-d-bugs mailing list