[cfe-users] is this compiller error

FRANČEK PRIJATELJ via cfe-users cfe-users at lists.llvm.org
Fri Feb 7 01:39:31 PST 2020


/*

Following code compiled with clang-cl on win10 generates 2 errors
(while the same code compiled with MS cl compiles):

t1.cpp(12,35): error: in-class initializer for static data member is not 
a constant expression
         static const int64_t MIN_VALUE = -0x8000000000000000LL;
                                          ^~~~~~~~~~~~~~~~~~~~~
t1.cpp(15,39): error: in-class initializer for static data member is not 
a constant expression
     static const int64_t MIN_VALUE1 = -9223372036854775808LL;
                                       ^~~~~~~~~~~~~~~~~~~~~~
2 errors generated.

*/

#include <string>

static const int64_t MAX_VALUE = 0x7fffffffffffffffLL;
static const int64_t MIN_VALUE = -0x8000000000000000LL;

static const int64_t MAX_VALUE1 = 9223372036854775807LL;
static const int64_t MIN_VALUE1 = -9223372036854775808LL;


class X  {
     static const int64_t MAX_VALUE = 0x7fffffffffffffffLL;
     static const int64_t MIN_VALUE = -0x8000000000000000LL;

     static const int64_t MAX_VALUE1 = 9223372036854775807LL;
     static const int64_t MIN_VALUE1 = -9223372036854775808LL;
};




More information about the cfe-users mailing list