This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/58709] New: [c++11] Bogus? int vs. scoped enum printf warning when -fabi-version >= 6


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.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]