This is the mail archive of the gcc-patches@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]
Other format: [Raw text]

Re: [patch] Fix PR c++/19498: ICE on invalid reference in templateparameter


Volker Reichelt wrote:
Consider the following testcase:

  template<typename T> struct A
  {
      template<T&> struct B;
  };

A<void> a;

When instantiating A<void> the compiler has to substitute T with
void in the declaration of struct B. This is done in tsubst_decl by
calling tsubst_template_args. Since void& is an invalid type, the
substitution fails and tsubst_template_args correctly returns
error_mark_node.

However, the compiler fails to check for the error_mark_node and instead
calls retrieve_specialization with an error_mark_node as second argument.
This results in an ICE.

The attached patch fixes the ICE by adding a check for error_mark_node
and adds the above testcase.

Bootstrapped and regtested on i686-pc-linux-gnu.
Ok for mainline?

OK.


--
Mark Mitchell
CodeSourcery, LLC
mark@codesourcery.com
(916) 791-8304


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