problem with a structure nested within a template

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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;
}

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux