https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119642
Bug ID: 119642
Summary: [15 regression] diagnostic push has no effect because
of unmatched pop in bits/formatfwd.h
Product: gcc
Version: 15.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libstdc++
Assignee: unassigned at gcc dot gnu.org
Reporter: enrico.seiler+gccbugs at outlook dot com
Target Milestone: ---
The following code shows warnings for the ignored diagnostics (-Wall -Wextra)
```
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-parameter"
#pragma GCC diagnostic ignored "-Wunused-local-typedefs"
#include <bits/formatfwd.h>
void foo(int x)
{
using t = int;
}
#pragma GCC diagnostic pop
```
https://godbolt.org/z/z6bdjzEfc
This is a reduced test case from a cpp with more complex includes.
The formatfwd.h header was introduced (and the problem occurs) since
https://gcc.gnu.org/cgit/gcc/commit/?id=84d668b0ca67c5d3fe6430f101d61e60aa796a81
Looks like there is a stray `#pragma GCC diagnostic pop` at the end without
matching push.