https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116847
--- Comment #17 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Jakub Jelinek <ja...@gcc.gnu.org>: https://gcc.gnu.org/g:64072e60b1599ae7d347c2cdee46c3b0e37fc338 commit r15-3929-g64072e60b1599ae7d347c2cdee46c3b0e37fc338 Author: Jakub Jelinek <ja...@redhat.com> Date: Fri Sep 27 16:07:40 2024 +0200 diagnostic: Save/restore diagnostic context history and push/pop state for PCH [PR116847] The following patch on top of the just posted cleanup patch saves/restores the m_classification_history and m_push_list vectors for PCH. Without that as the testcase shows during parsing of the templates we don't report ignored diagnostics, but after loading PCH header when instantiating those templates those warnings can be emitted. This doesn't show up on x86_64-linux build because configure injects there -fcf-protection -mshstk flags during library build (and so also during PCH header creation), but make check doesn't use those flags and so the PCH header is ignored. 2024-09-26 Jakub Jelinek <ja...@redhat.com> PR libstdc++/116847 gcc/ * diagnostic.h (diagnostic_option_classifier): Add pch_save and pch_restore method declarations. (diagnostic_context): Add pch_save and pch_restore inline method definitions. * diagnostic.cc (diagnostic_option_classifier::pch_save): New method. (diagnostic_option_classifier::pch_restore): Likewise. gcc/c-family/ * c-pch.cc: Include diagnostic.h. (c_common_write_pch): Call global_dc->pch_save. (c_common_read_pch): Call global_dc->pch_restore. gcc/testsuite/ * g++.dg/pch/pr116847.C: New test. * g++.dg/pch/pr116847.Hs: New test.