[Issue 9372] Class member with @disabled ctor makes class ctor unusable
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Thu Jan 24 04:43:06 PST 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9372
--- Comment #8 from Jacob Carlborg <doob at me.com> 2013-01-24 04:43:05 PST ---
(In reply to comment #7)
> The issue is debatable, but code below should be supported;
>
> import std.stdio;
>
> struct Trouble {
> @disable this();
> @disable this(this);
>
> int dummy;
>
> this(int x) {
> dummy = x;
> }
> }
>
> class Room {
> Trouble t = Trouble(123); // this should work
>
> this() {
> //t = Trouble(123);
> }
> }
>
> void main() {
> auto r = new Room; // this is line 23
> }
>
> Current situation shows either limitation of new implementation (druntime) or
> design.
I think that should work. The constructor does not initialize the fields, it's
done before the constructor is called. This works:
extern (C) Object _d_newclass(in ClassInfo);
class Room
{
int i = 3;
this (int f) {}
}
void main ()
{
auto room = cast(Room) _d_newclass(Room.classinfo);
assert(room.i == 3);
}
The constructor is not called but the field is initialized anyway.
--
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