digitalmars.D.bugs - [Issue 11060] New: delete gives InvalidMemoryOperationError
- d-bugmail puremagic.com (36/36) Sep 17 2013 http://d.puremagic.com/issues/show_bug.cgi?id=11060
- d-bugmail puremagic.com (12/12) Sep 17 2013 http://d.puremagic.com/issues/show_bug.cgi?id=11060
- d-bugmail puremagic.com (18/19) Sep 17 2013 http://d.puremagic.com/issues/show_bug.cgi?id=11060
- d-bugmail puremagic.com (9/9) Sep 17 2013 http://d.puremagic.com/issues/show_bug.cgi?id=11060
http://d.puremagic.com/issues/show_bug.cgi?id=11060
Summary: delete gives InvalidMemoryOperationError
Product: D
Version: D2
Platform: All
OS/Version: All
Status: NEW
Severity: major
Priority: P2
Component: DMD
AssignedTo: nobody puremagic.com
ReportedBy: thelastmammoth gmail.com
class B{
int*a;
this(){
a=new int;
}
~this(){
version(A1)
delete a;//core.exception.InvalidMemoryOperationError ; even though
http://dlang.org/deprecate.html#delete doesn't list as deprecated yet
version(A2)
a.clear;//works even though docs recommends DEPRECATED 'Scheduled for
deprecation in December 2012. Please use destroy instead of clear.'; and should
appear in http://dlang.org/deprecate.html#delete
version(A3)
a.destroy;//OK
}
}
void main(){
auto a=new B;
}
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Sep 17 2013
http://d.puremagic.com/issues/show_bug.cgi?id=11060
Maxim Fomin <maxim maxim-fomin.ru> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
CC| |maxim maxim-fomin.ru
Resolution| |INVALID
---
Please read the spec.
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Sep 17 2013
http://d.puremagic.com/issues/show_bug.cgi?id=11060Please read the spec.It would be helpful if you could be more specific. * as I wrote in the bug report, why is 'clear' not deprecated even though spec says it should be by december 2012? (and it's also in several phobos modules) * according to http://dlang.org/memory.html, 'If there is a delete(), there should be a corresponding new()' In my example, there is no new() function, so why does it even compile? * according to Jonathan Davis (see email "allocate array with new"): "No. _Never_ use delete. It's going to be deprecated". * in http://dlang.org/deprecate.html#delete, it says delete will be deprecated at a later time. * a number of phobos modules use delete. So all in all the spec is not very clear to me, and maybe to others as well. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Sep 17 2013
http://d.puremagic.com/issues/show_bug.cgi?id=11060 --- This was discussed really plenty of times - current garbage collector is not reenterable. So, if GC during garbage collection calls destructor, you cannot invoke any operation which directly or indirectly calls the GC. Clear() and destroy() work because they don't call the GC. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Sep 17 2013









d-bugmail puremagic.com 