2011-06-20 Jason Merrill <jason@redhat.com>
+ PR c++/48138
+ * tree.c (strip_typedefs): Use build_aligned_type.
+
PR c++/49205
* call.c (sufficient_parms_p): Allow parameter packs too.
if (!result)
result = TYPE_MAIN_VARIANT (t);
+ if (TYPE_USER_ALIGN (t) != TYPE_USER_ALIGN (result)
+ || TYPE_ALIGN (t) != TYPE_ALIGN (result))
+ {
+ gcc_assert (TYPE_USER_ALIGN (t));
+ if (TYPE_ALIGN (t) == TYPE_ALIGN (result))
+ result = build_variant_type_copy (result);
+ else
+ result = build_aligned_type (result, TYPE_ALIGN (t));
+ TYPE_USER_ALIGN (result) = true;
+ }
if (TYPE_ATTRIBUTES (t))
result = cp_build_type_attribute_variant (result, TYPE_ATTRIBUTES (t));
return cp_build_qualified_type (result, cp_type_quals (t));
2011-06-20 Jason Merrill <jason@redhat.com>
+ PR c++/48138
+ * g++.dg/ext/attr-aligned01.C: New.
+
PR c++/49205
* g++.dg/cpp0x/variadic-default.C: New.
--- /dev/null
+// PR c++/48138
+// { dg-options -std=c++0x }
+
+#define ALIGNED(x) __attribute__((aligned(x)))
+#define SA(X) static_assert ((X),#X)
+
+template<typename T>
+void type_alignment(const T&) {
+ struct { char c; T t; } s;
+ SA((char*)&s.t - (char*)&s.c == 8);
+}
+
+int main() {
+ typedef char unaligned[15];
+ typedef char aligned[15] ALIGNED(8);
+
+ aligned z;
+ type_alignment(z);
+ type_alignment<unaligned ALIGNED(8)>(z);
+}