This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: 3.2.2 vs. 3.3.2 - forward declaration
- From: Eljay Love-Jensen <eljay at adobe dot com>
- To: ilejn at yandex dot ru, gcc-help at gcc dot gnu dot org
- Date: Fri, 17 Dec 2004 10:13:20 -0600
- Subject: Re: 3.2.2 vs. 3.3.2 - forward declaration
- References: <41C2FF02.00000F.12493@camay.yandex.ru>
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