summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>2002-04-11 14:17:56 +0000
committerrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>2002-04-11 14:17:56 +0000
commit89cad2afd46604e93d494b6a9f5368bf4351cfbd (patch)
tree6115d7c540e4175a16050ebc6d5d3694a3799513
parentfb30a357c1cdca4100b26518c3aee682224ef561 (diff)
downloadppe42-gcc-89cad2afd46604e93d494b6a9f5368bf4351cfbd.tar.gz
ppe42-gcc-89cad2afd46604e93d494b6a9f5368bf4351cfbd.zip
* g++.dg/ext/attrib5.C: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@52160 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/testsuite/ChangeLog4
-rw-r--r--gcc/testsuite/g++.dg/ext/attrib5.C27
2 files changed, 31 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 93ef461fc1b..eeb964a9220 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 00000000000..47511934cc9
--- /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" }
OpenPOWER on IntegriCloud