[Bug c++/87667] New: -Wformat + typed enum class - difference with clang
lebedev.ri at gmail dot com
gcc-bugzilla@gcc.gnu.org
Sat Oct 20 18:04:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87667
Bug ID: 87667
Summary: -Wformat + typed enum class - difference with clang
Product: gcc
Version: 8.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: lebedev.ri at gmail dot com
Target Milestone: ---
https://godbolt.org/z/GX-Fqv
#include <stdio.h>
enum class Enum : unsigned short {
One,
};
void test(Enum e) {
printf("0x%04hx", e);
}
gcc:
<source>: In function 'void test(Enum)':
<source>:8:12: warning: format '%hx' expects argument of type 'int', but
argument 2 has type 'Enum' [-Wformat=]
printf("0x%04hx", e);
^~~~~~~~~ ~
Compiler returned: 0
Clang is fine with that.
Who is wrong?
More information about the Gcc-bugs
mailing list