extern(C++) and struct (constness mangling problem ?)

deadalnix deadalnix at gmail.com
Wed Nov 30 04:54:10 PST 2011


Le 30/11/2011 13:30, Timon Gehr a écrit :
> On 11/30/2011 11:57 AM, deadalnix wrote:
>> 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 ?
>>
>
> Built-in properties can be hidden (I am almost sure it is by design),
> void[0] just means 'field with size 0' and is explicitly allowed by the
> language specification. @disable is by design as well. I orthogonally
> combined those three features in order to disable the built-in .init
> property.
>

Yes, I understand that, but the property belong to the struct, not each 
instance, so it should not work unsless it is static. Am I wrong ?


More information about the Digitalmars-d mailing list