PR c++/88830 - ICE with abstract class.
authorMarek Polacek <polacek@redhat.com>
Mon, 14 Jan 2019 20:09:10 +0000 (20:09 +0000)
committerMarek Polacek <mpolacek@gcc.gnu.org>
Mon, 14 Jan 2019 20:09:10 +0000 (20:09 +0000)
* decl2.c (maybe_emit_vtables): Check CLASSTYPE_LAZY_DESTRUCTOR.
Fix formatting.

* g++.dg/other/abstract7.C: New test.

From-SVN: r267924

gcc/cp/ChangeLog
gcc/cp/decl2.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/other/abstract7.C [new file with mode: 0644]

index 5d0ef1217bb105bed26428fae53d8ed245b5b23f..3c1a02f025e2521282d775bbd685bccc03aa2d27 100644 (file)
@@ -1,3 +1,9 @@
+2019-01-14  Marek Polacek  <polacek@redhat.com>
+
+       PR c++/88830 - ICE with abstract class.
+       * decl2.c (maybe_emit_vtables): Check CLASSTYPE_LAZY_DESTRUCTOR.
+       Fix formatting.
+
 2019-01-14  Tom Honermann  <tom@honermann.net>
 
        Implement P0482R5, char8_t: A type for UTF-8 characters and strings
index 1314ca812ee2b9895d3af1900f91f72660d51465..0869fd3082472c64205545cbf9fb76a9f5e8eaf6 100644 (file)
@@ -2229,8 +2229,9 @@ maybe_emit_vtables (tree ctype)
      never get generated.  */
   if (CLASSTYPE_PURE_VIRTUALS (ctype)
       && TYPE_HAS_NONTRIVIAL_DESTRUCTOR (ctype)
-      && DECL_DEFAULTED_IN_CLASS_P(CLASSTYPE_DESTRUCTOR(ctype)))
-    note_vague_linkage_fn (CLASSTYPE_DESTRUCTOR(ctype));
+      && !CLASSTYPE_LAZY_DESTRUCTOR (ctype)
+      && DECL_DEFAULTED_IN_CLASS_P (CLASSTYPE_DESTRUCTOR (ctype)))
+    note_vague_linkage_fn (CLASSTYPE_DESTRUCTOR (ctype));
 
   /* Since we're writing out the vtable here, also write the debug
      info.  */
index 8c6f9e419baf7f69b1f0887d45068f520a9a87e5..d207a5193729dff8d09d8405e1fd4e2698512cd7 100644 (file)
@@ -1,3 +1,8 @@
+2019-01-14  Marek Polacek  <polacek@redhat.com>
+
+       PR c++/88830 - ICE with abstract class.
+       * g++.dg/other/abstract7.C: New test.
+
 2019-01-14  Martin Sebor  <msebor@redhat.com>
 
        PR target/88638
diff --git a/gcc/testsuite/g++.dg/other/abstract7.C b/gcc/testsuite/g++.dg/other/abstract7.C
new file mode 100644 (file)
index 0000000..9578160
--- /dev/null
@@ -0,0 +1,14 @@
+// PR c++/88830
+
+struct a {
+  ~a();
+};
+class b {
+  virtual void c(int &);
+};
+class C : b {
+  void c(int &);
+  virtual int d() = 0;
+  a e;
+};
+void C::c(int &) {}