digitalmars.D.bugs - invariant bug or documentation error.
- Dave (19/19) Feb 05 2005 Private member g() in an invariant block causes a stack overflow, contra...
- Dave (2/21) Feb 05 2005
- Thomas Kuehne (14/33) Feb 06 2005 -----BEGIN PGP SIGNED MESSAGE-----
Private member g() in an invariant block causes a stack overflow, contrary
to the doc.: http://digitalmars.com/d/class.html
class Foo
{
int i = 10;
private int g() { return i = 1; }
this(){}
invariant
{
g(); // Causes Stack Overflow after constructor is called
assert(i >= 10);
}
}
void main()
{
Foo f = new Foo();
assert(f); // or when this is executed
f.g(); // or when this is called.
}
Feb 05 2005
This applies to dmd v0.111.
In article <cu30gc$29cb$1 digitaldaemon.com>, Dave says...
Private member g() in an invariant block causes a stack overflow, contrary
to the doc.: http://digitalmars.com/d/class.html
class Foo
{
int i = 10;
private int g() { return i = 1; }
this(){}
invariant
{
g(); // Causes Stack Overflow after constructor is called
assert(i >= 10);
}
}
void main()
{
Foo f = new Foo();
assert(f); // or when this is executed
f.g(); // or when this is called.
}
Feb 05 2005
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Dave schrieb am Sat, 5 Feb 2005 11:43:33 -0600:
Private member g() in an invariant block causes a stack overflow, contrary
to the doc.: http://digitalmars.com/d/class.html
class Foo
{
int i = 10;
private int g() { return i = 1; }
this(){}
invariant
{
g(); // Causes Stack Overflow after constructor is called
assert(i >= 10);
}
}
void main()
{
Foo f = new Foo();
assert(f); // or when this is executed
f.g(); // or when this is called.
}
Added to DStress as
http://dstress.kuehne.cn/run/invariant_19.d
http://dstress.kuehne.cn/run/invariant_20.d
http://dstress.kuehne.cn/run/invariant_21.d
http://dstress.kuehne.cn/run/invariant_22.d
Thomas
-----BEGIN PGP SIGNATURE-----
iD8DBQFCBf073w+/yD4P9tIRAsoAAJ4k1hQqgPd9b0fWTgR3PWKgzo9JoQCfXMnx
WDW/MkhZ5PQ+D80YqF5Nyz8=
=62nc
-----END PGP SIGNATURE-----
Feb 06 2005









Dave <Dave_member pathlink.com> 