--- Comment #4 from Kenji Hara <> 2012-09-21 06:26:06 PDT ---
(In reply to comment #1)
> This works just fine too (with dmd 2.060HEAD)
> struct Foo
> {
>     @disable this();
> }
> void main()
> {
>     auto foo = Foo.init;
> }
> It looks to me like @disable this() isn't working at all.

I think that built-in init property should be valid even if default ctor is
T.init shows runtime object initial bit-wise representation. So, in this case,
Foo.init would be 1 byte zero filled memory, and should be accessible even if
Foo is not default constructible.

But T.init sometimes does not *valid* object. See following example.

struct Bar
    int value;

    @disable this();
    this(int v) { assert(v > 0); value = v; }

Bar's constructor appeals that Bar.value is initialized with natural number.
But Bar.init.value == 0, because it doesn't call valid ctor. Then T.init is
*invalid* object.
This is not a defect of D language, but also it is a point you should be

Configure issuemail:
------- You are receiving this mail because: -------

Reply via email to