[Bug c/41517] Unexpected behaviour of #pragma in statement context
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=41517 --- Comment #5 from Jan Echternach --- The testcases changed or added in bug 63326 comment 21 were all about #pragma omp. I don't understand the parser changes well enough to tell if #pragma GCC will be treated in the same way, i.e. if it will also produce an error after if(...) or for(...). If it does, I think it would be a fine resolution and I wouldn't mind if this bug was closed as a duplicate. From my point of view as a user, a difference between C and C++ is harmless as long as there's no silent change in semantics. In other words, it would be no problem for me if the C parser rejected code that the C++ parser accepted.
[Bug c/41517] Unexpected behaviour of #pragma in statement context
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=41517 Jan Echternach changed: What|Removed |Added CC||jan.echternach at de dot gbs.com --- Comment #1 from Jan Echternach --- I can confirm this bug in gcc 4.9 (Debian 4.9.2-10). A different example which also produces wrong code (should return 0, but returns 1): //#include int main () { if (0) #pragma GCC diagnostic ignored "-Wtype-limits" { //printf ("bug\n"); return 1; } //printf ("ok\n"); return 0; } And an example that fails to compile ("error: ‘else’ without a previous ‘if’"): void foo (void) { if (0) #pragma GCC diagnostic ignored "-Wtype-limits" {} else {} }