Error about @disabled constructor when there is a custom one

deadalnix deadalnix at gmail.com
Wed Jan 23 05:33:43 PST 2013


On Wednesday, 23 January 2013 at 13:26:47 UTC, Simen Kjaeraas 
wrote:
> On 2013-14-23 13:01, deadalnix <deadalnix at gmail.com> wrote:
>
>> On Wednesday, 23 January 2013 at 10:55:43 UTC, Simen Kjaeraas 
>> wrote:
>>> On 2013-48-23 11:01, deadalnix <deadalnix at gmail.com> wrote:
>>>
>>>> On Wednesday, 23 January 2013 at 10:28:05 UTC, Simen 
>>>> Kjaeraas wrote:
>>>>>> NonNull!T bar = something;
>>>>>> foo(move(bar));
>>>>>> bar; // bar is null \o/
>>>>>
>>>>> Except it isn't.
>>>>
>>>> move memcopy T.init . So it will be null.
>>>
>>> Try it. Without a destructor, move does not revert to T.init. 
>>> With a destructor you get this:
>>>
>>> src\phobos\std\algorithm.d(1564): Error: variable 
>>> std.algorithm.move!(NotNull!(int*)).move.empty initializer 
>>> required for type NotNull!(int*)
>>> Error: template instance std.algorithm.move!(NotNull!(int*)) 
>>> error instantiating
>>>
>>> This is what @disable this does, and what it's supposed to do.
>>
>> Ho that is awesome !
>>
>> Still many way of generating it on the heap, but it seems that 
>> the stack is getting better !
>
> Hm. The heap. That should be new NotNull!(int*), and
> (new NotNull!(int*)[1])[0]. The former is correctly not 
> allowed, and the
> latter is a different manifestation of the same bug mentioned 
> previously.
>
> Of course, with casts and pointers, anything is possible.

I was more thinking about slice and stuff like that. struct on 
the heap in general are not very handy.


More information about the Digitalmars-d mailing list