extern(C++) and struct (constness mangling problem ?)
deadalnix
deadalnix at gmail.com
Wed Nov 30 02:57:45 PST 2011
Le 30/11/2011 03:07, Andrei Alexandrescu a écrit :
> On 11/29/11 2:22 PM, Timon Gehr wrote:
>> The default initializer can easily be disabled:
>>
>> struct S{
>> int x;
>> @disable this();
>> @disable void[0] init;
>> @disable this(this);
>> }
>>
>> Now nobody can do
>> auto x = S.init;
>>
@disable void[0] init; Sound hacky as hell. Is it made by design, or is
it a consequence of the current compiler implementation ?
>> But it is still possible to do:
>>
>> S[1] x;
>>
>> I'd have expected that to fail with disabled this(). Is this a bug?
>
> Yes.
>
> Andrei
It make much more sense that way. At least we can prevent us from
getting garbage struct when it comes to interface with C++.
More information about the Digitalmars-d
mailing list