www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - structs - Forward Referencing.

Hello I stumbled across something that seems odd to me, but may infact be
intentional.

Whenever I try to use a struct in a class(possibly in another struct, haven't
tried) before it has been defined I get the following compile error.

"struct MyStruct no size yet for forward reference"

this doesn't happen with classes. And I can use the struct in functions, just
not in as class member.

To illustrate...

class A {
B b; //Works
St s; //Does not work.
}

class B {
//Whatever
}

struct St {
//Stuff
}

Anyway, I just wanted to throw this out there. It is a small issue and fairly
easily avoided.
Aug 08 2004