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

            Bug ID: 47295
           Summary: Invalid error on  long long literal
                    -9223372036854775808LL as a  long long array value
           Product: clang
           Version: 6.0
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangb...@nondot.org
          Reporter: francis.andre.kampb...@orange.fr
                CC: blitzrak...@gmail.com, dgre...@apple.com,
                    erik.pilking...@gmail.com, llvm-bugs@lists.llvm.org,
                    richard-l...@metafoo.co.uk

Hello

Compiling the sample below;
static const long long jjlonglong = -9223372036854775808LL;
static const long long jjlonglong1 = 0xFFFFFFFFFFFFFFFF;

static const long long jjCharData[][41] = {
        {2LL, 1LL, -9223372036854775808LL}
};

int main() {
        return 0;
}

Clang is producing those messages
x.cpp:2:38: warning: integer literal is too large to be represented in a signed
integer type, interpreting as unsigned [-Wimplicitly-unsigned-literal]
static const long long jjlonglong = -9223372036854775808LL;
                                     ^
x.cpp:6:14: warning: integer literal is too large to be represented in a signed
integer type, interpreting as unsigned [-Wimplicitly-unsigned-literal]
        {2LL, 1LL, -9223372036854775808LL}
                    ^
x.cpp:6:13: error: constant expression evaluates to 9223372036854775808 which
cannot be narrowed to type 'long long' [-Wc++11-narrowing]
        {2LL, 1LL, -9223372036854775808LL}
                   ^~~~~~~~~~~~~~~~~~~~~~
x.cpp:6:13: note: insert an explicit cast to silence this issue
        {2LL, 1LL, -9223372036854775808LL}
                   ^~~~~~~~~~~~~~~~~~~~~~
                   static_cast<long long>( )


The same long long literal as -9223372036854775808LL should produce the same
warning, be used as initializer of a simple variable or a long long array
member.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to