digitalmars.D.bugs - default ctor & inheritance bug
- Ilya Zaitseff (28/28) Dec 20 2004 Code below outputs '1' instead '0'.
- Simon Buchan (16/45) Dec 20 2004 dmd 0.109 on XP outputs 0. What version do you use?
- Ilya Zaitseff (4/42) Dec 21 2004 Strange, on the other machine there is no such bug.
-
Simon Buchan
(21/23)
Dec 21 2004
On Wed, 22 Dec 2004 13:27:26 +1000, Ilya Zaitseff
- Thomas Kuehne (11/11) Dec 23 2004 -----BEGIN PGP SIGNED MESSAGE-----
Code below outputs '1' instead '0'. 'bar' value overrides 'foo' value, when in there are no ctor in class 'B'. If uncomment B ctor, output is '0', as expected. <code> class A { this() {} } class B: A { int foo; // this() {} } class C: B { int bar; this() { foo = 0; bar = 1; } } void main() { C c = new C(); printf("%d", c.foo); // 1, expecting 0 } </code>
Dec 20 2004
On Tue, 21 Dec 2004 00:10:47 +1000, Ilya Zaitseff <sark7 mail333.com> wrote:Code below outputs '1' instead '0'. 'bar' value overrides 'foo' value, when in there are no ctor in class 'B'. If uncomment B ctor, output is '0', as expected. <code> class A { this() {} } class B: A { int foo; // this() {} } class C: B { int bar; this() { foo = 0; bar = 1; } } void main() { C c = new C(); printf("%d", c.foo); // 1, expecting 0 } </code>dmd 0.109 on XP outputs 0. What version do you use? -- "Unhappy Microsoft customers have a funny way of becoming Linux, Salesforce.com and Oracle customers." - www.microsoft-watch.com: "The Year in Review: Microsoft Opens Up" -- "I plan on at least one critical patch every month, and I haven't been disappointed." - Adam Hansen, manager of security at Sonnenschein Nath & Rosenthal LLP (Quote from http://www.eweek.com/article2/0,1759,1736104,00.asp) -- "It's been a challenge to "reteach or retrain" Web users to pay for content, said Pizey" -Wired website: "The Incredible Shrinking Comic"
Dec 20 2004
On Tue, 21 Dec 2004 19:36:19 +1300, Simon Buchan <currently no.where> wrote:On Tue, 21 Dec 2004 00:10:47 +1000, Ilya Zaitseff <sark7 mail333.com> wrote:Strange, on the other machine there is no such bug. Maybe my D installation is broken.Code below outputs '1' instead '0'. 'bar' value overrides 'foo' value, when in there are no ctor in class 'B'. If uncomment B ctor, output is '0', as expected. <code> class A { this() {} } class B: A { int foo; // this() {} } class C: B { int bar; this() { foo = 0; bar = 1; } } void main() { C c = new C(); printf("%d", c.foo); // 1, expecting 0 } </code>dmd 0.109 on XP outputs 0. What version do you use?
Dec 21 2004
On Wed, 22 Dec 2004 13:27:26 +1000, Ilya Zaitseff <sark7 mail333.com> wrote: <snip>Strange, on the other machine there is no such bug. Maybe my D installation is broken.I am assusming there would have to be for it to do this... compiler version and environment may help (If they are not identical) Also: this may be somewhat like the eax "return" "behavior" (Its a feature, not a bug! :D), i.e. whatever was in eax is returned from void main(). Unless this always happens with different compilations... or something... -- "Unhappy Microsoft customers have a funny way of becoming Linux, Salesforce.com and Oracle customers." - www.microsoft-watch.com: "The Year in Review: Microsoft Opens Up" -- "I plan on at least one critical patch every month, and I haven't been disappointed." - Adam Hansen, manager of security at Sonnenschein Nath & Rosenthal LLP (Quote from http://www.eweek.com/article2/0,1759,1736104,00.asp) -- "It's been a challenge to "reteach or retrain" Web users to pay for content, said Pizey" -Wired website: "The Incredible Shrinking Comic"
Dec 21 2004
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Added to DStress as http://svn.kuehne.cn/dstress/run/constructor_07.d http://svn.kuehne.cn/dstress/run/constructor_08.d Thomas -----BEGIN PGP SIGNATURE----- iD8DBQFByypS3w+/yD4P9tIRAlYhAJ9GSEtD5dv69V5ODeKdgP5VSWuBNACfXPiE dPRvaN/2xpgadNoEmWlnwe0= =mZ74 -----END PGP SIGNATURE-----
Dec 23 2004