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]

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


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