<div dir="ltr"><div dir="ltr">On Fri, 7 Feb 2020 at 19:51, FRANČEK PRIJATELJ via cfe-users <<a href="mailto:cfe-users@lists.llvm.org">cfe-users@lists.llvm.org</a>> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">/*<br>
<br>
Following code compiled with clang-cl on win10 generates 2 errors<br>
(while the same code compiled with MS cl compiles):<br>
<br>
t1.cpp(12,35): error: in-class initializer for static data member is not <br>
a constant expression<br>
         static const int64_t MIN_VALUE = -0x8000000000000000LL;<br>
                                          ^~~~~~~~~~~~~~~~~~~~~<br>
t1.cpp(15,39): error: in-class initializer for static data member is not <br>
a constant expression<br>
     static const int64_t MIN_VALUE1 = -9223372036854775808LL;<br>
                                       ^~~~~~~~~~~~~~~~~~~~~~<br>
2 errors generated.<br></blockquote><div><br></div><div>These expressions have undefined behavior due to exhibiting signed overflow, and so are non-constant in C++11 onwards.</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
*/<br>
<br>
#include <string><br>
<br>
static const int64_t MAX_VALUE = 0x7fffffffffffffffLL;<br>
static const int64_t MIN_VALUE = -0x8000000000000000LL;<br>
<br>
static const int64_t MAX_VALUE1 = 9223372036854775807LL;<br>
static const int64_t MIN_VALUE1 = -9223372036854775808LL;<br>
<br>
<br>
class X  {<br>
     static const int64_t MAX_VALUE = 0x7fffffffffffffffLL;<br>
     static const int64_t MIN_VALUE = -0x8000000000000000LL;<br>
<br>
     static const int64_t MAX_VALUE1 = 9223372036854775807LL;<br>
     static const int64_t MIN_VALUE1 = -9223372036854775808LL;<br>
};<br>
<br>
<br>
_______________________________________________<br>
cfe-users mailing list<br>
<a href="mailto:cfe-users@lists.llvm.org" target="_blank">cfe-users@lists.llvm.org</a><br>
<a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-users" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-users</a><br>
</blockquote></div></div>