]> gcc.gnu.org Git - gcc.git/commitdiff
re PR c++/88181 (ICE: verify_type failed (error: type variant differs by TYPE_PACKED))
authorJakub Jelinek <jakub@redhat.com>
Tue, 27 Nov 2018 21:04:41 +0000 (22:04 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Tue, 27 Nov 2018 21:04:41 +0000 (22:04 +0100)
PR c++/88181
* class.c (fixup_attribute_variants): Also propagate TYPE_PACKED
to variants.

* g++.dg/debug/pr88181.C: New test.

From-SVN: r266527

gcc/cp/ChangeLog
gcc/cp/class.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/debug/pr88181.C [new file with mode: 0644]

index 8e157f6c25c1a20c04e4f372b2622e2137e2d96f..41e66c082974372e6c8860ea9ba505a2b38b60e6 100644 (file)
@@ -1,3 +1,9 @@
+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.
index 0b50f67157882f036f0fd741a99843ff241e74cb..be3b4bbbe19e6828374b4543a5f20a2ba09a579f 100644 (file)
@@ -1951,6 +1951,7 @@ fixup_attribute_variants (tree t)
   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);
@@ -1968,6 +1969,7 @@ fixup_attribute_variants (tree t)
       else
        TYPE_USER_ALIGN (variants) = user_align;
       SET_TYPE_ALIGN (variants, valign);
+      TYPE_PACKED (variants) = packed;
       if (may_alias)
        fixup_may_alias (variants);
     }
index 0e211c98e547562b9f2a5ffd3f5a9639a250fbef..d35a3f87cd1bb58fbbf5d317368ac73f4460cd81 100644 (file)
@@ -1,5 +1,8 @@
 2018-11-27  Jakub Jelinek  <jakub@redhat.com>
 
+       PR c++/88181
+       * g++.dg/debug/pr88181.C: New test.
+
        PR middle-end/87157
        * gcc.dg/vect/costmodel/ppc/costmodel-vect-33.c (main1): Add noipa
        attribute.
diff --git a/gcc/testsuite/g++.dg/debug/pr88181.C b/gcc/testsuite/g++.dg/debug/pr88181.C
new file mode 100644 (file)
index 0000000..fc6f813
--- /dev/null
@@ -0,0 +1,29 @@
+// 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);
+}
This page took 0.106198 seconds and 5 git commands to generate.