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


Hi,

The following testcase triggers a seg fault in build_vfield_ref:

struct A
{
 operator int();
};

struct B : virtual A, A<0> {};

int foo(B &b)
{
 return b;
}

The attached fixes this by adopting an "all or nothing" approach in
cp_parser_base_clause where if any base class is found to be invalid
(as indicated by cp_parser_base_specifier returning error_mark_node)
then all of the bases classes are discarded by returning NULL_TREE.

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

Cheers,
Lee.

:ADDPATCH c++:

cp/
2006-10-18  Lee Millward  <lee.millward@codesourcery.com>

       PR c++/29022
       * parser.c (cp_parser_base_clause): If any of the
       base clauses are invalid, discard all of them.

testsuite/
2006-10-18  Lee Millward  <lee.millward@codesourcery.com>

       PR c++/29022
       * g++.dg/inherit/virtual2.C: New test.

Attachment: pr29022.txt
Description: Text document


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