D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 15632 - Calling delete on scope class should be an error?
Summary: Calling delete on scope class should be an error?
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P1 enhancement
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-01-31 15:11 UTC by Iain Buclaw
Modified: 2022-05-30 16:58 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Iain Buclaw 2016-01-31 15:11:36 UTC
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
Comment 1 Nick Treleaven 2022-05-30 13:36:32 UTC
Presumably this can be closed now `delete` is gone:

Error: the `delete` keyword is obsolete
Comment 2 Iain Buclaw 2022-05-30 16:58:02 UTC
Yes.