This is the mail archive of the gcc-bugs@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]

Re: 'curiously recursive template' example


On Jun 29, 1999, "B. K. Oxley (binkley) at Home" <binkley@bigfoot.com> wrote:

> template<class T> struct FuncPtr_helper
> { typedef typename T::f (*f) ( ); };
> struct FuncPtr_typedef : FuncPtr_helper<FuncPtr_typedef> { }

> main.cc:7: Internal compiler error.

Thanks for your bug report.  The upcoming gcc 2.95 will report:

main.cc: In instantiation of `FuncPtr_helper<FuncPtr_typedef>':
main.cc:7:   instantiated from here
main.cc:3: invalid use of undefined type `struct FuncPtr_typedef'
main.cc:6: forward declaration of `struct FuncPtr_typedef'
main.cc:9: syntax error before `;'

And a few other errors caused by these.  In fact, because
FuncPtr_helper requires its argument to be a complete type,
FuncPtr_helper<FuncPtr_typedef> can't be instantiated before
FuncPtr_typedef is fully defined, so the template instantiation can't
be used as a base class.

-- 
Alexandre Oliva http://www.dcc.unicamp.br/~oliva IC-Unicamp, Bra[sz]il
{oliva,Alexandre.Oliva}@dcc.unicamp.br  aoliva@{acm.org,computer.org}
oliva@{gnu.org,kaffe.org,{egcs,sourceware}.cygnus.com,samba.org}
*** E-mail about software projects will be forwarded to mailing lists


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