http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58709
Bug ID: 58709
Summary: [c++11] Bogus? int vs. scoped enum printf warning when
-fabi-version >= 6
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: ppluzhnikov at google dot com
Test:
#include <stdio.h>
enum class Foo {
FOO
};
int main()
{
printf("%d\n", Foo::FOO);
}
Using "g++ (GCC) 4.9.0 20131005 (experimental)":
$ g++ -c -std=c++11 -Wformat t.cc
$
$ g++ -c -std=c++11 -Wformat t.cc -fabi-version=6
t.cc:9:26: warning: format ‘%d’ expects argument of type ‘int’, but argument 2
has type ‘Foo’ [-Wformat=]
printf("%d\n", Foo::FOO);
^
From gcc/common.opt:
; 6: The version of the ABI that doesn't promote scoped enums to int and ...
This seems like a bug -- even though the scoped enum is not promoted to an int,
printf warning doesn't seem appropriate here either.