* g++.dg/ext/attrib5.C: New test.

From-SVN: r52158
This commit is contained in:
Richard Sandiford 2002-04-11 14:09:27 +00:00 committed by Richard Sandiford
parent e67af10f27
commit b99f20ca20
2 changed files with 31 additions and 0 deletions

View File

@ -1,3 +1,7 @@
2002-04-11 Richard Sandiford <rsandifo@redhat.com>
* g++.dg/ext/attrib5.C: New test.
2002-04-10 Jakub Jelinek <jakub@redhat.com>
PR middle-end/6247

View File

@ -0,0 +1,27 @@
// There were two related problems here, depending on the vintage. At
// one time:
//
// typedef struct A { ... } A __attribute__ ((aligned (16)));
//
// would cause original_types to go into an infinite loop. At other
// times, the attributes applied to an explicit typedef would be lost
// (check_b2 would have a negative size).
// First check that the declaration is accepted and has an effect.
typedef struct A { int i; } A __attribute__ ((aligned (16)));
int check_A[__alignof__ (A) >= 16 ? 1 : -1];
// Check that the alignment is only applied to the typedef.
struct B { int i; };
namespace N { typedef B B; };
typedef struct B B __attribute__((aligned (16)));
N::B b1;
B b2;
int check_b1[__alignof__ (b1) == __alignof__ (int) ? 1 : -1];
int check_b2[__alignof__ (b2) >= 16 ? 1 : -1];
// The fix for this case involved a change to lookup_tag. This
// bit just checks against a possible regression.
namespace N { struct C; };
typedef struct N::C C; // { dg-error "previous declaration" }
struct C; // { dg-error "conflicting types" }