TITLE: templates and incomplete types PROBLEM: clgonsal@undergrad.math.uwaterloo.ca (Carl Laurence Gonsalves) I'm trying to do something like this: template< class T > class Foo{ bar( T& t ){ T *val; // stuff... val = new T( t ); // stuff... } }; Basically, I'm trying to use the copy constructor of "T". I tried compiling this with GCC and it said: "Invalid use of undefined type 'struct T'." RESPONSE: clamage@Eng.Sun.COM (Steve Clamage), 21 Aug 95 The code you show is valid. When you intantiate the template, however, you must use a complete type. If you did something along these lines struct X; Foo f0; // incomplete type X Foo f1; // unknown type Y it could possibly cause such an error message. If you did instantiate Foo with a defined type, it might be a compiler bug -- see if you have the latest version of gcc.