[Issue 9372] Class member with @disabled ctor makes class ctor unusable

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Jan 23 07:52:52 PST 2013


http://d.puremagic.com/issues/show_bug.cgi?id=9372



--- Comment #2 from hsteoh at quickfur.ath.cx 2013-01-23 07:52:50 PST ---
(In reply to comment #1)

Maybe it makes sense on some level, perhaps from the implementation POV, but to
me, a language-level user, it makes no sense at all, because a ctor is supposed
to be what initializes the class instance.

Furthermore, a class with a ctor that takes more than zero parameters causes
"auto x = new Class;" to be rejected, because the ctor cannot be called with no
arguments. So to me, this indicates that the ctor will always be called (as
expected); the compiler never says "OK you called new with no parameters, I'll
just default-initialize all your class fields". Since this is the case, it
makes no sense to now suddenly require that all fields be
default-initializable. It has always been the ctor's job to initialize all
fields.

(In fact that's why I chose to use a class instead of a struct, since structs
can be declared without calling any ctors.)

-- 
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