diff options
author | Richard Sandiford <rsandifo@redhat.com> | 2002-04-11 14:17:56 +0000 |
---|---|---|
committer | Richard Sandiford <rsandifo@gcc.gnu.org> | 2002-04-11 14:17:56 +0000 |
commit | 3135284bfb13354a482f3c9271db6830df9ac9f1 (patch) | |
tree | 6115d7c540e4175a16050ebc6d5d3694a3799513 /gcc | |
parent | d75ff184174b2678007e544e63491b741b940c07 (diff) | |
download | gcc-3135284bfb13354a482f3c9271db6830df9ac9f1.zip gcc-3135284bfb13354a482f3c9271db6830df9ac9f1.tar.gz gcc-3135284bfb13354a482f3c9271db6830df9ac9f1.tar.bz2 |
* g++.dg/ext/attrib5.C: New test.
From-SVN: r52160
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/testsuite/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/ext/attrib5.C | 27 |
2 files changed, 31 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 93ef461..eeb964a 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2002-04-11 Richard Sandiford <rsandifo@redhat.com> + + * g++.dg/ext/attrib5.C: New test. + 2002-04-10 Janis Johnson <janis187@us.ibm.com> * g77.f-torture/execute/6177.f: New test. diff --git a/gcc/testsuite/g++.dg/ext/attrib5.C b/gcc/testsuite/g++.dg/ext/attrib5.C new file mode 100644 index 0000000..4751193 --- /dev/null +++ b/gcc/testsuite/g++.dg/ext/attrib5.C @@ -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" } |