OSDN Git Service

PR c++/13114, c++/13115
authornathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 12 Dec 2003 14:48:31 +0000 (14:48 +0000)
committernathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 12 Dec 2003 14:48:31 +0000 (14:48 +0000)
* class.c (layout_empty_base): Propagate the move of an empty base
to offset zero.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@74573 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/cp/ChangeLog
gcc/cp/class.c
gcc/testsuite/g++.dg/abi/covariant2.C

index 0e90958..6b57a91 100644 (file)
@@ -1,5 +1,9 @@
 2003-12-12  Nathan Sidwell  <nathan@codesourcery.com>
 
+       PR c++/13114, c++/13115
+       * class.c (layout_empty_base): Propagate the move of an empty base
+       to offset zero.
+
        PR c++/12881
        * method.c (make_thunk): Deal with thunk aliases when searching
        for a thunk. Robustify assertion.
index 72f03a2..bc44452 100644 (file)
@@ -3576,14 +3576,18 @@ layout_empty_base (tree binfo, tree eoc, splay_tree offsets)
   /* This routine should only be used for empty classes.  */
   my_friendly_assert (is_empty_class (basetype), 20000321);
   alignment = ssize_int (CLASSTYPE_ALIGN_UNIT (basetype));
-  
-  if (abi_version_at_least (2))
-    BINFO_OFFSET (binfo) = size_zero_node;
-  if (warn_abi && !integer_zerop (BINFO_OFFSET (binfo)))
-    warning ("offset of empty base `%T' may not be ABI-compliant and may"
-            "change in a future version of GCC",
-            BINFO_TYPE (binfo));
 
+  if (!integer_zerop (BINFO_OFFSET (binfo)))
+    {
+      if (abi_version_at_least (2))
+       propagate_binfo_offsets
+         (binfo, size_diffop (size_zero_node, BINFO_OFFSET (binfo)));
+      else if (warn_abi)
+       warning ("offset of empty base `%T' may not be ABI-compliant and may"
+                "change in a future version of GCC",
+                BINFO_TYPE (binfo));
+    }
+  
   /* This is an empty base class.  We first try to put it at offset
      zero.  */
   if (layout_conflict_p (binfo,
index 233c55a..87eb2a2 100644 (file)
@@ -2,7 +2,7 @@
 
 // Copyright (C) 2003 Free Software Foundation, Inc.
 // Contributed by Nathan Sidwell 12 Dec 2003 <nathan@codesourcery.com>
-// Origin: Volker Reichelt <reichelt@igpm.rwth-aachen.de>
+// Origin: grigory@stl.sarov.ru
 
 // PR c++/12881. ICE in thunk generation