https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82335
--- Comment #1 from pskocik at gmail dot com --- This problem still persists in gcc 7.3.0. It appears pasting a macro containing `_Pragma`s into another macro is what's causing the displacement of the generated `#pragma`s. I've cleaned up the example to make it clearer: #define PRAGMA(...) _Pragma(#__VA_ARGS__) #define PASTE(Expr) Expr #define PUSH_IGN(X) PRAGMA(GCC diagnostic push) PRAGMA(GCC diagnostic ignored X) #define POP() PRAGMA(GCC diagnostic pop) #define SIGNED_EH(X) \ ({ PUSH_IGN("-Wtype-limits") \ _Bool SIGNED_EH = ((__typeof(X))-1 < 0); \ POP() \ SIGNED_EH; }) int main(); { unsigned x; SIGNED_EH(x); //OK; #pragmas generated around the assignment: #if 0 //generated: ({ #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wtype-limits" _Bool SIGNED_EH = ((__typeof(x))-1 < 0); #pragma GCC diagnostic pop SIGNED_EH; }); #endif PASTE(SIGNED_EH(x)); //OOPS generates: #if 0 //generated: #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wtype-limits" #pragma GCC diagnostic pop ({ _Bool SIGNED_EH = ((__typeof(x))-1 < 0); SIGNED_EH; }); #endif } Clang's preprocessor generates correct code even for the `PASTE(SIGNED_EH(x))` case.