http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57241
Bug ID: 57241 Summary: GCC still issues -Wmultichar warnings despite a #pragma diagnostic ignored -Wmultichar directive Product: gcc Version: 4.8.1 Status: UNCONFIRMED Severity: minor Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: scottbaldwin at gmail dot com In GCC 4.7.2 and 4.8.x, the #pragma ignore directive for -Wmultichar has no effect. The code below demonstrates a -Wmultichar which is still emitted as a warning despite the #pragma directive to ignore it. Specifying -Wno-multichar on the command line works fine, so this is just an issue with trying to suppress it with a #pragma directive (which I need for finer-grained control). Note: I didn't test the other diagnostic options to see if there are others besides -Wmultichar that have the same issue, so you might want to do a full check on all diagnostic options. Here's the demo code and unsuppressed compiler warnings: int main() { #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wmultichar" typedef boost::mpl::string<'0123', '4567', '89ab', 'cdef'> hex_chars; // -Wmultichar (gcc still issues warnings, despite #pragma ignore directive) #pragma GCC diagnostic pop return 0; } warnings in gcc 4.7.2: sandbox_cpp11.cpp:148:29: warning: multi-character character constant [-Wmultichar] sandbox_cpp11.cpp:148:37: warning: multi-character character constant [-Wmultichar] sandbox_cpp11.cpp:148:45: warning: multi-character character constant [-Wmultichar] sandbox_cpp11.cpp:148:53: warning: multi-character character constant [-Wmultichar] warnings in gcc 4.8.x: sandbox_cpp11.cpp:148:29: warning: multi-character character constant [-Wmultichar] typedef boost::mpl::string<'0123', '4567', '89ab', 'cdef'> hex_chars; ^ sandbox_cpp11.cpp:148:37: warning: multi-character character constant [-Wmultichar] typedef boost::mpl::string<'0123', '4567', '89ab', 'cdef'> hex_chars; ^ sandbox_cpp11.cpp:148:45: warning: multi-character character constant [-Wmultichar] typedef boost::mpl::string<'0123', '4567', '89ab', 'cdef'> hex_chars; ^ sandbox_cpp11.cpp:148:53: warning: multi-character character constant [-Wmultichar] typedef boost::mpl::string<'0123', '4567', '89ab', 'cdef'> hex_chars;