Fix error recovery in toplev::finalize.

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.
This commit is contained in:
Martin Liska 2022-02-28 11:58:01 +01:00
parent 800b3191c7
commit 1060d06b4d
2 changed files with 12 additions and 3 deletions

View File

@ -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;
}

View File

@ -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" } */
};