[llvm-bugs] [Bug 37865] New: Warn on overflow in user-defined literals

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Jun 19 22:49:47 PDT 2018


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

            Bug ID: 37865
           Summary: Warn on overflow in user-defined literals
           Product: clang
           Version: unspecified
          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:

int operator"" _w(unsigned long long){return 0;}
int main(){
 return 12345678901234567890123456789012345678901234567890_w;
}

clang++ produces an error message:

error: integer literal is too large to be represented in any integer type
     return 12345678901234567890123456789012345678901234567890_w;
            ^
    1 error generated.

g++ accepts it. Indeed, the code comes from a gcc bug report:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52654

Please check this problem. I believe that it is a bug in clang++.

-- 
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/20180620/1e07be82/attachment.html>


More information about the llvm-bugs mailing list