This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: ICE 42 trying to use explicit template-instantiation
- To: Peter Nordlund <petern at nada dot kth dot se>
- Subject: Re: ICE 42 trying to use explicit template-instantiation
- From: Alexandre Oliva <oliva at dcc dot unicamp dot br>
- Date: 21 Sep 1998 05:58:00 +-300
- Cc: egcs-bugs at cygnus dot com, jason at cygnus dot com, mark at markmitchell dot com
- References: <3605176D.41C6@nada.kth.se>
Peter Nordlund <petern@nada.kth.se> writes:
> I get ICE 42 trying to use explicit template-instantiation.
> (I'm not sure if I'm writing legal C++ code)
Your code is incorrect, but this is no excuse for an ICE. It is not
possible to provide explicit template arguments to constructors, since
constructors do not have names [temp.mem]/5.
> struct test{ template <int I> test(){ } };
> int main() { test c=test::test<1>(); return 0; }
I've been investigating this problem, and I found out that
get_type_decl() receives an error_mark_node in this case, produced by
lookup_template_class() because test::test is a class name, but not
the name of a template class. Shouldn't lookup_template_class() print
an error message? Maybe it could check whether there are template
constructors in the class, and print an error message in this case.
Otherwise, when we get to get_type_decl(), there won't be enough
information for a good error message.
--
Alexandre Oliva
mailto:oliva@dcc.unicamp.br mailto:aoliva@acm.org
http://www.dcc.unicamp.br/~oliva
Universidade Estadual de Campinas, SP, Brasil