mangle.c (write_unqualified_name): Handle template parm subtitution.

* 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
This commit is contained in:
Jason Merrill 2002-07-17 12:43:42 -04:00
parent d28586abe7
commit db50171f40
3 changed files with 80 additions and 0 deletions

View File

@ -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);
}

View File

@ -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 *));
}

View File

@ -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 } }