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: unassignedclangb...@nondot.org
          Reporter: zhong...@pku.org.cn
                CC: dgre...@apple.com, llvm-bugs@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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to