dmd 1.070 and 2.055 release

Steven Schveighoffer schveiguy at yahoo.com
Mon Sep 12 07:43:36 PDT 2011


On Sun, 11 Sep 2011 13:57:12 -0400, 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!

While I agree a nested "@disable this" struct inside a struct should  
disable default construction of the outer struct, a class *requires*  
initialization, and a default constructor is called explicitly (and can be  
defined!)  We are talking two different worlds here.

I think the above should be accepted.  I'm not sure how feasible it is,  
since it requires code path analysis.

-Steve


More information about the Digitalmars-d-announce mailing list