https://bugs.llvm.org/show_bug.cgi?id=39369

            Bug ID: 39369
           Summary: -Wformat + typed enum class - difference with gcc
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangb...@nondot.org
          Reporter: lebedev...@gmail.com
                CC: llvm-bugs@lists.llvm.org

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?

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to