https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100891
Bug ID: 100891
Summary: #pragma GCC diagnostic ignored
Product: gcc
Version: 10.3.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: tobi at gcc dot gnu.org
Target Milestone: ---
$ cat t.cpp
#if defined(__GNUC__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wmultichar"
// Check that I'm disabling warnings correctly: the following warnings
disappear correctly:
#pragma GCC diagnostic ignored "-Wnarrowing"
#pragma GCC diagnostic ignored "-Woverflow"
#endif
constexpr int native{ 'ABCD' };
constexpr short i{123456}; // crosscheck
#if defined(__GNUC__)
#pragma GCC diagnostic pop
#endif
$ g++ -Wall -c t.cpp
t.cpp:8:35: warning: multi-character character constant [-Wmultichar]
constexpr int native{ 'ABCD' };
^~~~~~
$
Compiler explorer link here: https://godbolt.org/z/P5cjqKs4a
Verified with all versions on the compiler explorer back to 6.2.