mangle.c (write_unqualified_name): Handle template parm subtitution.
authorJason Merrill <jason@gcc.gnu.org>
Wed, 17 Jul 2002 16:43:42 +0000 (12:43 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Wed, 17 Jul 2002 16:43:42 +0000 (12:43 -0400)
* mangle.c (write_unqualified_name): Handle template parm
subtitution.
* class.c (build_base_field): Set DECL_PACKED.
(layout_class_type): Don't use tail padding of PODs.

From-SVN: r55535

gcc/testsuite/g++.dg/abi/layout1.C [new file with mode: 0644]
gcc/testsuite/g++.dg/abi/layout2.C [new file with mode: 0644]
gcc/testsuite/g++.dg/abi/mangle8.C [new file with mode: 0644]

diff --git a/gcc/testsuite/g++.dg/abi/layout1.C b/gcc/testsuite/g++.dg/abi/layout1.C
new file mode 100644 (file)
index 0000000..645ed6a
--- /dev/null
@@ -0,0 +1,31 @@
+// Red Hat bugzilla 64535
+// Bug: We are allocationg stuff into the tail padding of POD class "A".
+// { dg-do run }
+
+struct A
+{
+  int x;
+  char y;
+};
+
+struct B : public A {
+  virtual void f () {}
+  char z;
+};
+
+A a = { 21, 42 };
+B b;
+
+int
+main (void)
+{
+  b.x = 12;
+  b.y = 24;
+  b.z = 36;
+
+  A *ap = &b;
+
+  *ap = a;
+
+  return (b.z != 36);
+}
diff --git a/gcc/testsuite/g++.dg/abi/layout2.C b/gcc/testsuite/g++.dg/abi/layout2.C
new file mode 100644 (file)
index 0000000..fb4e1e5
--- /dev/null
@@ -0,0 +1,33 @@
+// Red Hat bugzilla 65210
+// { dg-do run }
+
+struct A {
+    int a;
+};
+
+struct B : public virtual A {};
+
+struct C {
+  long double c;
+};
+
+struct D : public virtual C {
+    int d;
+};
+
+struct E : public B, public D {
+    int e;
+};
+
+E e;
+
+/* The layout of E should begin with the B-in-E vtable pointer, followed by
+   the D-in-E vtable pointer.  The bug was that we used to pad out the D
+   fields for long double alignment.  */
+
+int main ()
+{
+  D* dp = &e;
+  unsigned long d_offset = ((char*)dp) - ((char*) &e);
+  return (d_offset != sizeof(void *));
+}
diff --git a/gcc/testsuite/g++.dg/abi/mangle8.C b/gcc/testsuite/g++.dg/abi/mangle8.C
new file mode 100644 (file)
index 0000000..6a07358
--- /dev/null
@@ -0,0 +1,16 @@
+// Red Hat bugzilla 65035
+// Bug: We were encoding the name of the instantiation as 'operator int'
+// rather than 'operator T'.
+// { dg-do compile }
+
+struct C {
+    template <class T>
+    operator T ();
+};
+
+template <class T>
+C::operator T () { return 0; }
+
+template C::operator int ();
+
+// { dg-final { scan-assembler _ZN1CcvT_IiEEv } }