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


Hi,

The following invalid testcase currently triggers a seg fault in
decay_conversion:

struct A
{
   virtual ~A() {}
};

struct B : A, virtual A {};
struct C : A, B {};

C c;

The proposed fix for this to adjust the return type of xref_basetypes
to bool so that the parser can detect if processing the base classes
failed in cp_parser_class_head (in which case xref_basetypes will
return false), if it has then the type is set to NULL_TREE which,
according to the comment at the top of the function, will cause the
type to be discarded, preventing the ICE later on.

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

Cheers,
Lee.

:ADDPATCH c++:

cp/

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

       PR c++/27952
       * cp-tree.h (xref_basetypes): Adjust to return bool instead of void.
       * decl.c (xref_basetypes): Likewise. Return false if the class
        bases are invalid.
       * parser.c (cp_parser_class_head): Check the return value
       from xref_basetypes, discard the type is the base classes are invalid.

2006-10-17 Lee Millward <lee.millward@codesuorcery.com>

       PR c++/27952
       * g++.dg/inherit/virtual1.C: New test.

Attachment: pr27952.txt
Description: Text document


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