dmd 1.070 and 2.055 release
Simen Kjaeraas
simen.kjaras at gmail.com
Mon Sep 12 07:24:56 PDT 2011
On Sun, 11 Sep 2011 19:57:12 +0200, Walter Bright
<newshound2 at digitalmars.com> wrote:
> On 9/11/2011 9:08 AM, Max Samukha wrote:
>> This test case
>>
>> struct S
>> {
>> @disable this();
>> this(int x)
>> {
>> }
>> }
>>
>> class C
>> {
>> S s;
>> this()
>> {
>> s = S(42);
>> }
>> }
>>
>> void main()
>> {
>> auto c = new C;
>> }
>>
>> yields Error: default construction is disabled for type C
>>
>> Is it a bug?
>
> No, it's a feature!
Surely this must be a mistake. A class's constructor is always called when
it
is created, and for non-default constructors, an uninitialized value with
@disable this() is detected. There *needs* to be a way to re-enable default
construction for classes containing structs with disabled default
constructors.
If this is simply something that is not yet done, that's fine.
--
Simen
More information about the Digitalmars-d-announce
mailing list