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: ICE 42 trying to use explicit template-instantiation


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



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