[LLVMbugs] [Bug 24293] New: Clang incorrectly thinks that enumerators of enum does not fit in the largest integer type

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Jul 28 15:42:11 PDT 2015


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

            Bug ID: 24293
           Summary: Clang incorrectly thinks that enumerators of enum does
                    not fit in the largest integer type
           Product: clang
           Version: trunk
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: anders.granlund.0 at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Consider the following well-formed program (prog.cc):

#include <limits>
enum E { x = std::numeric_limits<long long int>::max(), y };
int main() {}

Compile it with the following command line:

clang++ prog.cc -stdlib=libc++ -std=c++14 -pedantic-errors

The enumerators x and y fits in unsigned long long int, but clang incorrectly
gives the following error message:

prog.cc:2:57: error: incremented enumerator value 9223372036854775808 is not
representable in the largest integer type [-Werror,-Wenum-too-large]
enum E { x = std::numeric_limits<long long int>::max(), y };
                                                        ^
1 error 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/20150728/2e27db40/attachment.html>


More information about the llvm-bugs mailing list