no size yet for forward reference for nested structures

Ali Çehreli via Digitalmars-d digitalmars-d at puremagic.com
Wed Jan 14 10:41:35 PST 2015


On 01/14/2015 07:39 AM, ketmar via Digitalmars-d wrote:
> On Wed, 14 Jan 2015 07:09:44 -0800
> Ali Çehreli via Digitalmars-d <digitalmars-d at puremagic.com> wrote:
>
>> Reduced:
>>
>> import std.container;
>>
>> class Node
>> {
>>       SList!Node children;
>> }
>>
>> void main()
>> {}
>>
>> Error: class deneme.Node no size yet for forward reference
>>
>> I wonder why an SList of a reference type requires the size of the
>> elements? The following compiles but is that a pointer to a class
>> variable or a class object? How can we even use the 'children' member?
>>
>>       SList!(Node*) children;
>
> i don't know: i've never used `std.container` anyway. ;-)
>

It looks like this came up not too long ago:

 
http://forum.dlang.org/thread/akkrerlsjutdfmzswsbo@forum.dlang.org#post-akkrerlsjutdfmzswsbo:40forum.dlang.org

I think this is a bug but I will wait for others to confirm.

Ali



More information about the Digitalmars-d mailing list