Bug 14837 – Class constructor is not called under *certain* conditions
Status
RESOLVED
Resolution
FIXED
Severity
major
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Windows
Creation time
2015-07-27T14:21:00Z
Last change time
2015-07-27T15:10:42Z
Assigned to
nobody
Creator
czdanol
Comments
Comment #0 by czdanol — 2015-07-27T14:21:14Z
Hey, this is quite a big problem here (maybe not for you, but it is for me).
I have this code:
http://pastebin.com/h5Zaz00m
Expected output is:
-------------------
main called
moduleInit called
P constructor
C constructor
TEST
10
-------------------
But we get:
-------------------
main called
moduleInit called
TEST
0
-------------------
That means that neither C's or P's constructor is called, for unknown reasons. From further tests I found out that the memory is allocated.
Tested on 2.067 and 2.065
Comment #1 by czdanol — 2015-07-27T14:42:44Z
Also, it rather seems it behaves like the class had the default constructor only, as when trying to call constructors with arguments, it spits "Error: no constructor for (...)"
Comment #2 by k.hara.pg — 2015-07-27T14:50:26Z
Works with 2.068.0-beta2.
Comment #3 by czdanol — 2015-07-27T14:51:23Z
Haha thanks, I guess I gotta get the build done :D
Comment #4 by czdanol — 2015-07-27T15:10:42Z
Okay, looks like it got fixed in 2.068. Thanks for the info and sorry for the panic.