This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
problem with a structure nested within a template
- From: "Paul Ianna" <paulianna2002 at gmail dot com>
- To: gcc-help at gcc dot gnu dot org
- Date: Tue, 21 Nov 2006 13:04:51 -0500
- Subject: problem with a structure nested within a template
Hi All,
I'm perplexed and hoping to obtain some guru insight from the community.
The code below is a snippet from some existing code that compiles with
many other compilers, but not gcc (I tried both 3.4.4 and 4.1.1
versions).
The problem line is: C1<U>::Node* pNode;
and the error is: error: expected `;' before '*' token
If I use a concrete type (e.g., C1<int>), all is well.
Thanks in advance,
Paul
///////////////////////////////////////
template<typename T>
class C1
{
public:
struct Node
{
T* prev;
T* next;
};
Node myNode;
};
///////////////////////////////////////
template<typename U>
class C2
{
public:
U someObj;
C1<U>::Node* pNode;
};
///////////////////////////////////////
int main()
{
C1<int> c1;
C2<int> c2;
return 0;
}