public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Fix error recovery in toplev::finalize.
@ 2022-02-28 11:49 Martin Liška
  2022-02-28 12:55 ` Richard Biener
  2022-02-28 15:30 ` David Malcolm
  0 siblings, 2 replies; 5+ messages in thread
From: Martin Liška @ 2022-02-28 11:49 UTC (permalink / raw)
  To: gcc-patches

Use flag_checking instead of CHECKING_P
and run toplev::finalize only if there is not error seen.

Patch can bootstrap on x86_64-linux-gnu and survives regression tests.

Ready to be installed?
Thanks,
Martin

	PR ipa/104648

gcc/ChangeLog:

	* main.cc (main): Use flag_checking instead of CHECKING_P
	and run toplev::finalize only if there is not error seen.

gcc/testsuite/ChangeLog:

	* g++.dg/pr104648.C: New test.
---
  gcc/main.cc                     | 6 +++---
  gcc/testsuite/g++.dg/pr104648.C | 9 +++++++++
  2 files changed, 12 insertions(+), 3 deletions(-)
  create mode 100644 gcc/testsuite/g++.dg/pr104648.C

diff --git a/gcc/main.cc b/gcc/main.cc
index f9dd6b2af58..4ba28b7de53 100644
--- a/gcc/main.cc
+++ b/gcc/main.cc
@@ -37,9 +37,9 @@ main (int argc, char **argv)
  		 true /* init_signals */);
  
    int r = toplev.main (argc, argv);
-#if CHECKING_P
-  toplev.finalize ();
-#endif
+
+  if (flag_checking && !seen_error ())
+    toplev.finalize ();
  
    return r;
  }
diff --git a/gcc/testsuite/g++.dg/pr104648.C b/gcc/testsuite/g++.dg/pr104648.C
new file mode 100644
index 00000000000..b8b7c2864cf
--- /dev/null
+++ b/gcc/testsuite/g++.dg/pr104648.C
@@ -0,0 +1,9 @@
+// { dg-do compile }
+// { dg-options "-fvtable-verify=preinit" }
+
+struct A {};
+struct B : virtual A
+{
+  B () {};
+  B () {}; /* { dg-error "cannot be overloaded with" } */
+};
-- 
2.35.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-02-28 19:21 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-28 11:49 [PATCH] Fix error recovery in toplev::finalize Martin Liška
2022-02-28 12:55 ` Richard Biener
2022-02-28 15:30 ` David Malcolm
2022-02-28 17:47   ` Richard Biener
2022-02-28 19:21     ` David Malcolm

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).