Help?

Mike Parker aldacron at gmail.com
Fri Aug 30 21:58:24 PDT 2013


On Friday, 30 August 2013 at 17:28:12 UTC, 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...

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

A couple of other forward-ref bugs relating to opaque structs 
have been recently fixed in git master. If I knew where to look 
or what to do, I'd fix this one myself. It's an ongoing source of 
bug reports for Derelict and is bugging the hell out of me.


More information about the Digitalmars-d mailing list