[Issue 9438] Strange RefCounted stack overflow
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Fri Feb 1 08:11:51 PST 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9438
Maxim Fomin <maxim at maxim-fomin.ru> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |maxim at maxim-fomin.ru
--- Comment #1 from Maxim Fomin <maxim at maxim-fomin.ru> 2013-02-01 08:11:50 PST ---
The situation is more complicated.
import std.container, std.stdio, std.typecons, std.exception;
struct S
{
RefCounted!int _data;
this(int)
{_data.refCountedStore.ensureInitialized();}
int get() @property
{
writeln("here");
enforce(_data.refCountedStore.isInitialized); //OH NOES!!! //13
writeln("there");
return _data.refCountedPayload;
}
}
void main()
{
version (A) {
writeln(S(1).get);
}
version (B) {
S s;
writeln(s.get).collectException();
}
version (C) {
writeln(S().get);
}
}
When compiling with version A or B, everything is fine. Version C fails
enforcement on line 13. Both A and C throws failed enforcement. Both B and C
segfault in Refcounted dtor. Tested on linux64 git head.
--
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