+2001-07-27 Nathan Sidwell <nathan@codesourcery.com>
+
+ * class.c (finish_struct_1): When copying the primary base's
+ VFIELD, make sure we find it is at offset zero.
+
2001-07-26 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
* pt.c (tsubst_template_parms): Call maybe_fold_nontype_arg and
2001-07-26 Nathan Sidwell <nathan@codesourcery.com>
+ PR c++/3621
* spew.c (yylex): Only copy the token's lineno, if it is
non-zero.
/* Make sure that we get our own copy of the vfield FIELD_DECL. */
vfield = TYPE_VFIELD (t);
- if (vfield != NULL_TREE
- && DECL_FIELD_CONTEXT (vfield) != t)
- {
- tree binfo = get_binfo (DECL_FIELD_CONTEXT (vfield), t, 0);
-
+ if (vfield && CLASSTYPE_HAS_PRIMARY_BASE_P (t))
+ {
+ tree primary = CLASSTYPE_PRIMARY_BINFO (t);
+
+ my_friendly_assert (same_type_p (DECL_FIELD_CONTEXT (vfield),
+ BINFO_TYPE (primary)),
+ 20010726);
+ /* The vtable better be at the start. */
+ my_friendly_assert (integer_zerop (DECL_FIELD_OFFSET (vfield)),
+ 20010726);
+ my_friendly_assert (integer_zerop (BINFO_OFFSET (primary)),
+ 20010726);
+
vfield = copy_decl (vfield);
-
DECL_FIELD_CONTEXT (vfield) = t;
- DECL_FIELD_OFFSET (vfield)
- = size_binop (PLUS_EXPR,
- BINFO_OFFSET (binfo),
- DECL_FIELD_OFFSET (vfield));
TYPE_VFIELD (t) = vfield;
}
+ else
+ my_friendly_assert (!vfield || DECL_FIELD_CONTEXT (vfield) == t, 20010726);
overridden_virtuals
= modify_all_vtables (t, &vfuns, nreverse (overridden_virtuals));
+2001-07-27 Nathan Sidwell <nathan@codesourcery.com>
+
+ * g++.dg/abi/vbase8-10.C: New test.
+
2001-07-27 Rainer Orth <ro@TechFak.Uni-Bielefeld.DE>
* lib/g++.exp (g++_set_ld_library_path): Renamed to
--- /dev/null
+// { dg-options -w }
+// { dg-do run }
+
+// Copyright (C) 2001 Free Software Foundation, Inc.
+// Contributed by Nathan Sidwell 26 Jul 2001 <nathan@codesourcery.com>
+
+// Origin stefan@space.twc.de
+// Bug 3145 case 10. Horribly complicated class hierarchy
+
+class C0
+{};
+class C1
+ : public C0
+{};
+class C2
+ : public C1
+ , virtual public C0
+{};
+class C3
+ : public C1
+ , public C2
+ , virtual public C0
+{};
+class C4
+ : virtual public C1
+ , virtual public C0
+ , virtual public C3
+ , public C2
+{};
+class C5
+ : public C3
+ , virtual public C0
+ , virtual public C2
+{};
+class C6
+ : public C1
+ , public C2
+ , virtual public C5
+ , virtual public C3
+ , virtual public C0
+{};
+class C7
+ : public C1
+ , virtual public C5
+ , virtual public C4
+ , virtual public C2
+ , virtual public C0
+ , virtual public C6
+{};
+class C8
+ : virtual public C4
+ , public C3
+ , public C0
+ , virtual public C7
+ , virtual public C6
+{};
+class C9
+ : virtual public C0
+ , public C4
+ , public C8
+ , public C1
+ , public C6
+{};
+main() {
+ C0 c0;
+ C1 c1;
+ C2 c2;
+ C3 c3;
+ C4 c4;
+ C5 c5;
+ C6 c6;
+ C7 c7;
+ C8 c8;
+ C9 c9;
+}