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++/26938


Hi,

This bug is an ICE when a template is redeclared with the wrong number
of template arguments as shown in the following testcase:

template<int, int = 0> struct A;

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

A<0> a;

The attached patch fixes this bug by adjusting
redeclare_class_template to return bool instead of void - more
specifically it will now return false if an error was issued from
inside it. With this we can now check the redeclaration is valid from
inside xref_tag and to return error_mark_node if it's not.

Bootstrapped and regression tested on i686-pc-linux-gnu with no new
failures. Ok for mainline?

Cheers,
Lee.

:ADDPATCH c++:

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

       PR c++/26938
       * cp-tree.h (redeclare_class_template): Adjust declaration
       to return bool instead of void.
       * pt.c (redeclare_class_template): Update definition. Return
       false on error.
       * decl.c (xref_tag): Return error_mark_node if redeclare_class_template
       returned false.

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

       PR c++/26938
       * g++.dg/template/crash58.C: New test.
       * g++.dg/parse/crash28.C: Adjust error markers.
       * g++.dg/template/crash34.C: Likewise.
       * g++.dg/template/friend31.C: Likewise.
       * g++.dg/template/crash32.C: Likewise.

Attachment: pr26938.txt
Description: Text document


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