+2018-11-27 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/88181
+ * class.c (fixup_attribute_variants): Also propagate TYPE_PACKED
+ to variants.
+
2018-11-26 Marek Polacek <polacek@redhat.com>
PR c++/88120 - ICE when calling save_expr in a template.
unsigned align = TYPE_ALIGN (t);
bool user_align = TYPE_USER_ALIGN (t);
bool may_alias = lookup_attribute ("may_alias", attrs);
+ bool packed = TYPE_PACKED (t);
if (may_alias)
fixup_may_alias (t);
else
TYPE_USER_ALIGN (variants) = user_align;
SET_TYPE_ALIGN (variants, valign);
+ TYPE_PACKED (variants) = packed;
if (may_alias)
fixup_may_alias (variants);
}
--- /dev/null
+// PR c++/88181
+// { dg-do compile }
+// { dg-options "-fpack-struct -g -std=c++11" }
+
+template <typename T> struct A { typedef T B; };
+template <typename...> class C;
+template <typename e> struct D { constexpr D (e) {} };
+template <int, typename...> struct E;
+template <int N, typename T, typename... U>
+struct E<N, T, U...> : E<1, U...>, D<T> {
+ constexpr E (T x, U... y) : E<1, U...>(y...), D<T>(x) {}
+};
+template <int N, typename T> struct E<N, T> : D<T> {
+ constexpr E (T x) : D<T>(x) {}
+};
+template <typename T, typename U> struct C<T, U> : E<0, T, U> {
+ constexpr C (T x, U y) : E<0, T, U>(x, y) {}
+ void operator= (typename A<const C>::B);
+};
+struct F {};
+struct G {};
+
+int
+main ()
+{
+ F f;
+ G g;
+ constexpr C<F, G> c(f, g);
+}