[Bug c++/87667] -Wformat + typed enum class - difference with clang

2018-10-22 Thread lebedev.ri at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87667

Roman Lebedev  changed:

   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
   See Also||https://bugs.llvm.org/show_
   ||bug.cgi?id=39369
 Resolution|--- |INVALID

--- Comment #4 from Roman Lebedev  ---
clang agrees that the problem seems to be on their side.

[Bug c++/87667] -Wformat + typed enum class - difference with clang

2018-10-22 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87667

--- Comment #3 from Jonathan Wakely  ---
I think the warning is correct. A scoped enumeration type is not subject to
integral promotion, so the argument is not promoted to int. When the body of
printf tries to read an int from the argument the behaviour is undefined.

[Bug c++/87667] -Wformat + typed enum class - difference with clang

2018-10-22 Thread lebedev.ri at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87667

--- Comment #2 from Roman Lebedev  ---
(In reply to Jonathan Wakely from comment #1)
> It's a warning, why do you think either compiler is wrong?

Either it is incorrect to pass `enum class Enum : unsigned short`
when the format specifier is %hx (i.e. `unsigned short`),
and then the warning is justified; or the other way around,
it is correct to pass `Enum`, and the warning is not justified,
or needs different wording.

[Bug c++/87667] -Wformat + typed enum class - difference with clang

2018-10-22 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87667

--- Comment #1 from Jonathan Wakely  ---
It's a warning, why do you think either compiler is wrong?