re PR c++/17620 (Bogus error with duplicate base class breaks boost)

cp:
	PR c++/17620
	* decl.c (xref_basetypes): Look through typedefs before checking
	for duplicate base.
testsuite:
	PR c++/17620
	* g++.dg/inherit/base2.C: New.

From-SVN: r87938
This commit is contained in:
Nathan Sidwell 2004-09-23 10:09:09 +00:00 committed by Nathan Sidwell
parent e5a067e81a
commit 98d6e9afea
4 changed files with 35 additions and 10 deletions

View File

@ -1,3 +1,9 @@
2004-09-23 Nathan Sidwell <nathan@codesourcery.com>
PR c++/17620
* decl.c (xref_basetypes): Look through typedefs before checking
for duplicate base.
2004-09-22 Nathan Sidwell <nathan@codesourcery.com>
* cp-tree.h (unemitted_tinfo_decls): Make a VEC(tree).

View File

@ -9286,16 +9286,6 @@ xref_basetypes (tree ref, tree base_list)
continue;
}
if (TYPE_MARKED_P (basetype))
{
if (basetype == ref)
error ("recursive type `%T' undefined", basetype);
else
error ("duplicate base type `%T' invalid", basetype);
continue;
}
TYPE_MARKED_P (basetype) = 1;
if (TYPE_FOR_JAVA (basetype) && (current_lang_depth () == 0))
TYPE_FOR_JAVA (ref) = 1;
@ -9318,6 +9308,18 @@ xref_basetypes (tree ref, tree base_list)
CLASSTYPE_REPEATED_BASE_P (ref)
|= CLASSTYPE_REPEATED_BASE_P (basetype);
}
/* We must do this test after we've seen through a typedef
type. */
if (TYPE_MARKED_P (basetype))
{
if (basetype == ref)
error ("recursive type `%T' undefined", basetype);
else
error ("duplicate base type `%T' invalid", basetype);
continue;
}
TYPE_MARKED_P (basetype) = 1;
base_binfo = copy_binfo (base_binfo, basetype, ref,
&igo_prev, via_virtual);

View File

@ -1,3 +1,8 @@
2004-09-23 Nathan Sidwell <nathan@codesourcery.com>
PR c++/17620
* g++.dg/inherit/base2.C: New.
2004-09-22 Eric Botcazou <ebotcazou@libertysurf.fr>
* gcc.dg/20001012-1.c: Add prototypes for builtin functions.

View File

@ -0,0 +1,12 @@
// Copyright (C) 2004 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 23 Sep 2004 <nathan@codesourcery.com>
// Origin: Wolfgang Bangerth <bangerth@dealii.org>
// Bug 17620. Bogus duplicate base error.
struct S {};
typedef S B;
struct D1 : B {};
struct D2 : B {};