https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84127
Eric Gallager <egallager at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |egallager at gcc dot gnu.org --- Comment #3 from Eric Gallager <egallager at gcc dot gnu.org> --- (In reply to Martin Sebor from comment #1) > I can confirm that diagnostic pragmas that affect the preprocessor have no > effect in C++. When compiled in C mode all warnings are suppressed. > In C++ mode none is. (In reply to Jakub Jelinek from comment #2) > The reason why the GCC diagnostic ignore pragma works for this warning in C > and doesn't in C++ is that in C++ we preprocess/tokenize everything first > and only then start parsing it. The pragmas are handled while parsing > stuff, after all the preprocessing and thus also preprocessor diagnostics is > emitted. > > To handle what you want would require that we handle GCC diagnostic pragmas > twice, once during preprocessing using preprocessor tokenization > infrastructure first and then once again after the preprocessing. I think there's some other bug open about this, but I forget which it is...