c++/3024: class inheritance of template arguments fail

Gabriel Dos Reis Gabriel.Dos-Reis@cmla.ens-cachan.fr
Fri Jun 1 18:17:00 GMT 2001


"Artem Khodush" <artem@duma.gov.ru> writes:

| In C++, base class may not be an incomplete type.

Indeed, C++ requires base classes to be complete types.

| To elaborate:
| 
| template <typename T>
|  class Y : public T

Yes, at this point, the template argument should be a complete
class-type when instantiating. 

|  {
|  // T should be completely defined at this point.
|  };
|  
|  class X : public Y<X>
|  {
| // Y<X> should be completely defined at this point.
| // For it to be defined, X should be completely defined at this point, 
| // but it isn't - you can't break out of this dependency loop.

Right.

This is definitely -not- a bug in the compiler.

-- Gaby



More information about the Gcc-bugs mailing list