Forward references

Steven Schveighoffer schveiguy at yahoo.com
Sun Feb 25 22:20:13 UTC 2018


On 2/25/18 4:25 PM, Jiyan wrote:
> Hi,
> is there any document or text describing forward references?
> It is kinda strange, i implemented a list structure which is kinda like 
> this:
> 
> struct list(T)
> {
> private:
> 
> struct node
> {
> T val;
> node* next;
> node* prev;
> }
> 
> node* head;
> node* last;
> size_t size;
> 
>   .....
> }
> 
> The thing is when i implement following struct:
> 
> struct Tre
> {
> list!Tre a;
> }
> 
> theoretically it should be constructable. But it gives me out a compiler 
> error about Forward reference. Ok maybe the compiler at this point cant 
> do that but ...
> 
> The strange thing is i somehow managed earlier without knowing to do 
> exactly this in a much more complicated struct.
> Can somebody enlighten me about this?

Looks like this was fixed in 2.064.

What version of the compiler are you using?

-Steve


More information about the Digitalmars-d-learn mailing list