Help?

Ali Çehreli acehreli at yahoo.com
Fri Aug 30 11:06:14 PDT 2013


On 08/30/2013 10:27 AM, Manu wrote:
> struct MyStruct; // <- forward declared (opaque type, never defined)
>
> MyStruct*[] arrayOfPointers;
>
> arrayOfPointers ~= null; // appending doesn't work
> arrayOfPointers = new MyStruct*[n]; // or just allocating the array doesn't
> work either
>
> Complains:
> 1>code.d(84): Error: struct MyStruct is forward referenced when looking for
> 'toHash'
> 1>code.d(84): Error: struct MyStruct is forward referenced when looking for
> 'opCmp'
> 1>code.d(84): Error: struct MyStruct is forward referenced when looking for
> 'toString'
> 1>code.d(84): Error: struct MyStruct unknown size
> 1>code.d(84): Error: struct MyStruct no size yet for forward reference
> 1>code.d(84): Error: struct MyStruct unknown size
> 1>code.d(84): Error: struct MyStruct no size yet for forward reference
>
> What's the go here?
> Why would it need any of that information? It's just a pointer...
>

The effect on Variant:

   http://d.puremagic.com/issues/show_bug.cgi?id=10766

Ali



More information about the Digitalmars-d mailing list