[Issue 7066] You can redefine .init and .stringof without error

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Wed Oct 7 12:24:59 PDT 2015


https://issues.dlang.org/show_bug.cgi?id=7066

--- Comment #7 from Jonathan M Davis <issues.dlang at jmdavisProg.com> ---
(In reply to timon.gehr from comment #6)
> (In reply to Walter Bright from comment #1)
> > They're actually supposed to be overridable at the moment. I had thought
> > there might be a use for this, but so far none have materialized.
> > ...
> 
> There is one obvious use case:
> 
> struct S{ @disable enum init=0; }
> 
> It would be better to have a specific feature here though. E.g. 
> 
> struct S{ @disable init; }

I would have thought that

struct S{ @disable this(); }

would do that in addition to making

S s;

illegal. I was surprised to find out that it didn't. But if there _is_ a good
reason for

S s = S.init;

to still work with @disable this(); was used (though I certainly can't think of
one), then @disable init; should probably imply @disable this();.

--


More information about the Digitalmars-d-bugs mailing list