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]

[patch] Fix PR c++/28301


Hi,

This bug is an ICE in retrieve_specialization caused by the following
broken specialiation:

template<typename> struct A
{
   template<int> void foo()  // missing ;
};

template<> struct A<void>
{
   template<int> void foo();
};

void bar()
{
   A<void> a;
   a.foo<0>();
}

The attached patch fixes this ICE by discarding the specialisation
issuing an error about missing specialisation parameters, this is then
picked up in the parser which skips processing the remainder of the
broken specialisation.

Bootstrapped and regression tested on i686-pc-linux-gnu, ok for mainline?

Cheers,
Lee.

:ADDPATCH c++:

2006-09-09 Lee Millward <lee.millward@codesourcery.com>

       PR c++/28301
`       * pt.c (process_partial_specialization): Return error_mark_node
       if the partial specialization is missing some parameters.
       (maybe_process_partial_specialization): Check the return value
       of push_template_decl_real for error_mark_node.
       * parser.c (cp_parser_class_head): Skip processing of broken
       partial specializations.

2006-09-09 Lee Millward <lee.millward@codesourcery.com>

       PR c++/28301
       * g++.dg/template/spec34.C: New test.
       * g++.old-deja/g++.pt/crash4.C: Adjust error markers.
       * g++.dg/parse/crash9.C: Likewise.

Attachment: pr28301.txt
Description: Text document


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