[Issue 8563] Exception segfault
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Wed Jun 26 19:09:16 PDT 2013
http://d.puremagic.com/issues/show_bug.cgi?id=8563
--- Comment #5 from Nils <nilsbossung at googlemail.com> 2013-06-26 19:09:12 PDT ---
Some observations (includes the stuff form issue 10475):
struct DirIterator
{
int _store = 42;
this(string dummy) {throw new Exception("constructor");}
~this()
{
assert(_store == 42, "destructing garbage");
assert(false, "destructor");
}
}
DirIterator dirEntries() {return DirIterator("");}
void main()
{
/* This triggers only "constructor". The destructor is not called. */
version(A) DirIterator a = dirEntries();
/* This triggers "constructor" and "destructing garbage".
I.e. destructor is called on uninitialized data. Probably fine in this case
because of explicit void initialization. */
else version(B)
{
DirIterator b = void;
b = dirEntries();
}
/* This triggers "constructor" and "destructor".
Arguably, the destructor should not be called, since construction has
failed. */
else version(C) for(DirIterator c = DirIterator(""); true; ) {}
/* Just like B, this triggers "constructor" and "destructing garbage".
No explicit void initialization here, so that should not happen. */
else version(D) for(DirIterator c = dirEntries(); true;) {}
else static assert(false);
}
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list