On Sunday, 8 February 2015 at 19:57:28 UTC, Jonathan M Davis
wrote:
On Sunday, February 08, 2015 17:51:09 bearophile via
Digitalmars-d-learn wrote:
fra:
> However making it a compiler error would be far, far better
I think this can be filed in Bugzilla as diagnostic
enhancement:
class Foo {
@disable this();
this(int i) {}
}
void main() {}
The compiler should probably just give you an error telling you
that
disabling the default constructor on classes is illegal. And
since no
default constructor is automatically declared if you declare
another
constructor, there isn't even any point in disabling the
default constructor
(which is probably why no one has been complaining about this).
@disable
this() only makes sense on structs.
Alternatively, it could be accepted (and a no-op) if another
constructor is defined, but an error if not.