[llvm-bugs] [Bug 44532] New: clang-cl will incorrectly warn on enum size

via llvm-bugs llvm-bugs at lists.llvm.org
Sun Jan 12 18:11:48 PST 2020


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

            Bug ID: 44532
           Summary: clang-cl will incorrectly warn on enum size
           Product: clang
           Version: 9.0
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Driver
          Assignee: unassignedclangbugs at nondot.org
          Reporter: tiagomacarios at gmail.com
                CC: llvm-bugs at lists.llvm.org, neeilans at live.com,
                    richard-llvm at metafoo.co.uk

clang-cl will warn about enum representation on windows. On Linux, everything
works fine: https://godbolt.org/z/DpbxB3

AFAIU as per the standard the enum will have the type needed to fit the member,
so I don't understand the warning.

>clang-cl -c -std:c++17 -Weverything a.cpp
a.cpp(3,5): warning: enumerator value is not representable in the underlying
type 'int' [-Wmicrosoft-enum-value]
    e = 0xFFFFFFFFL
    ^
1 warning generated.

C:\Users\tiagoma\AppData\Local\Temp\temp>type a.cpp
enum
{
    e = 0xFFFFFFFFL
};

>clang-cl -c -std:c++17 -Weverything a.cpp
a.cpp(3,5): warning: enumerator value is not representable in the underlying
type 'int' [-Wmicrosoft-enum-value]
    e = 0xFFFFFFFFL
    ^
1 warning generated.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20200113/9aa5bae6/attachment-0001.html>


More information about the llvm-bugs mailing list