c++/6749: [2003-05-12] infinte loop with inheritance of abstract classes

Wolfgang Bangerth bangerth@ices.utexas.edu
Wed May 14 06:02:00 GMT 2003


This is even shorter than Nathanael's testcase:
--------------------------------
template <class T> struct inner {};
 
template <class T> struct parent {
    virtual void f()
      { parent<inner<T> > p; };
};
 
template struct parent<int>;
---------------------------------

I don't think it's particularly surprising that this puts gcc into a loong 
loop, since in parent<T> we instantiate parent<inner<T> >, in which we 
instantiate parent<inner<inner<T> > >, in which... well, we get the 
picture.

Compiling this indeed takes very long. I didn't check how, long, but what 
_is_ surprising, that it takes long already with -ftemplate-depth-2, which 
really shouldn't happen.

Funny testcase...

W.

-------------------------------------------------------------------------
Wolfgang Bangerth              email:            bangerth@ices.utexas.edu
                               www: http://www.ices.utexas.edu/~bangerth/




More information about the Gcc-bugs mailing list