re PR c++/72808 (ICE on valid c++ code in verify_type (gcc/tree.c:14047))
authorJakub Jelinek <jakub@redhat.com>
Mon, 28 Nov 2016 19:20:02 +0000 (20:20 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Mon, 28 Nov 2016 19:20:02 +0000 (20:20 +0100)
PR c++/72808
* decl.c (finish_enum_value_list): Call fixup_type_variants on
current_class_type after
insert_late_enum_def_into_classtype_sorted_fields.

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

Co-Authored-By: Jason Merrill <jason@redhat.com>
From-SVN: r242930

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

index f442a7a83f04b9990889266d304c273bea58ce54..476ff654bce7125d993b29c1e757a521be80aa75 100644 (file)
@@ -1,3 +1,11 @@
+2016-11-28  Jakub Jelinek  <jakub@redhat.com>
+           Jason Merrill  <jason@redhat.com>
+
+       PR c++/72808
+       * decl.c (finish_enum_value_list): Call fixup_type_variants on
+       current_class_type after
+       insert_late_enum_def_into_classtype_sorted_fields.
+
 2016-11-28  Jakub Jelinek  <jakub@redhat.com>
 
        PR c++/77591
index 6893eae084a08ec472556a396438900e2e15edc4..f0850d726ed3da7d3d29637896ceb9e41a84537a 100644 (file)
@@ -14280,8 +14280,11 @@ finish_enum_value_list (tree enumtype)
   if (at_class_scope_p ()
       && COMPLETE_TYPE_P (current_class_type)
       && UNSCOPED_ENUM_P (enumtype))
-    insert_late_enum_def_into_classtype_sorted_fields (enumtype,
-                                                      current_class_type);
+    {
+      insert_late_enum_def_into_classtype_sorted_fields (enumtype,
+                                                        current_class_type);
+      fixup_type_variants (current_class_type);
+    }
 
   /* Finish debugging output for this type.  */
   rest_of_type_compilation (enumtype, namespace_bindings_p ());
index 04a6840299df6fc9367ca72c50d7084212909838..0579927fa13eb6391b8dfe8b8ec4a9fa72724215 100644 (file)
@@ -1,5 +1,8 @@
 2016-11-28  Jakub Jelinek  <jakub@redhat.com>
 
+       PR c++/72808
+       * g++.dg/debug/pr72808.C: New test.
+
        PR rtl-optimization/78546
        * gcc.dg/torture/pr78546-1.c: New test.
        * gcc.dg/torture/pr78546-2.c: New test.
diff --git a/gcc/testsuite/g++.dg/debug/pr72808.C b/gcc/testsuite/g++.dg/debug/pr72808.C
new file mode 100644 (file)
index 0000000..7e4688c
--- /dev/null
@@ -0,0 +1,24 @@
+// PR c++/72808
+// { dg-do compile }
+// { dg-options "-g -std=c++14" }
+
+struct A
+{
+  virtual void foo ();
+};
+
+struct B : A
+{
+  void foo ();
+  enum C : int;
+};
+
+enum B::C : int
+{
+  D
+};
+
+void
+B::foo ()
+{
+}