Bug 2361 – delete is allowed on invariant references.

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2008-09-16T09:14:00Z
Last change time
2015-06-09T01:20:16Z
Keywords
accepts-invalid, patch
Assigned to
nobody
Creator
godaves
Blocks
2573

Comments

Comment #0 by godaves — 2008-09-16T09:14:51Z
import std.stdio; void main() { C c = new C(100); writefln(c.arr); writefln("----"); writefln(gar); writefln("----"); delete c.arr; delete gar; writefln(c.arr); writefln("----"); writefln(gar); } class C { invariant int[] arr; this(size_t sz) { arr = cast(invariant int[])new int[sz]; for(size_t i = 0; i < sz; i++) cast(int)arr[i] = i; } } const sz = 100; invariant int[] gar; static this() { gar = cast(invariant int[])new int[sz]; for(size_t i = 0; i < sz; i++) cast(int)gar[i] = i; }
Comment #1 by yebblies — 2011-06-29T10:46:36Z
Comment #2 by bugzilla — 2011-10-09T19:48:30Z