This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: 3.2.2 vs. 3.3.2 - forward declaration


Hi Ilja,

I think your code is running into a situation analogous to this one (see code below), but regarding templates instead of simple structures...

//------------------------------------------
class Foo;

struct Bar
{
        Foo foo; // error: field `foo' has incomplete type
};

class Foo
{
public:
        int i;
};

int main()
{
        Bar bar;
}
//------------------------------------------

If you declare the class before you instantiate it, it doesn't generate the error.

I'm not sure of the relevant ISO 14882 reference to cite, but I'd bet that there's one in there that addresses the situation you've run into.

HTH,
--Eljay


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]