[llvm-bugs] [Bug 38238] New: left operand of shift expression ‘(-1 << 4)’ is negative

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Jul 19 18:57:54 PDT 2018


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

            Bug ID: 38238
           Summary: left operand of shift expression ‘(-1 << 4)’ is
                    negative
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: zhonghao at pku.org.cn
                CC: dgregor at apple.com, llvm-bugs at lists.llvm.org

The code is as follow:

enum A { bit_mask = ~(-1 << 4) };

clang++ accepts it, but g++ rejects it:

code0.cpp:1:26: error: left operand of shift expression '(-1 << 4)' is negative
[-fpermissive]
 enum A { bit_mask = ~(-1 << 4) };
                      ~~~~^~~~~
code0.cpp:1:30: error: enumerator value for 'bit_mask' is not an integer
constant
 enum A { bit_mask = ~(-1 << 4) };

-- 
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/20180720/ea25a3e6/attachment.html>


More information about the llvm-bugs mailing list