FWIW, I think you could just give the enum an explicit underlying type of size_type.
On Tue, Jul 11, 2017 at 6:45 PM, Ben Craig via cfe-commits < cfe-commits@lists.llvm.org> wrote: > Author: bcraig > Date: Tue Jul 11 18:45:13 2017 > New Revision: 307751 > > URL: http://llvm.org/viewvc/llvm-project?rev=307751&view=rev > Log: > Fix unrepresentable enum for clang-cl unstable ABI > > When using LIBCXX_ABI_UNSTABLE=YES, clang-cl gave the following warning: > > P:\llvm_master\src\llvm\projects\libcxx\include\string(683,51): > warning: enumerator value is not representable in the underlying type > 'int' [-Wmicrosoft-enum-value] > > Fixed by switching from enums to static const size_type. > > https://reviews.llvm.org/D35174 > > Modified: > libcxx/trunk/include/string > > Modified: libcxx/trunk/include/string > URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/ > string?rev=307751&r1=307750&r2=307751&view=diff > ============================================================ > ================== > --- libcxx/trunk/include/string (original) > +++ libcxx/trunk/include/string Tue Jul 11 18:45:13 2017 > @@ -676,11 +676,11 @@ private: > }; > > #if _LIBCPP_BIG_ENDIAN > - enum {__short_mask = 0x01}; > - enum {__long_mask = 0x1ul}; > + static const size_type __short_mask = 0x01; > + static const size_type __long_mask = 0x1ul; > #else // _LIBCPP_BIG_ENDIAN > - enum {__short_mask = 0x80}; > - enum {__long_mask = ~(size_type(~0) >> 1)}; > + static const size_type __short_mask = 0x80; > + static const size_type __long_mask = ~(size_type(~0) >> 1); > #endif // _LIBCPP_BIG_ENDIAN > > enum {__min_cap = (sizeof(__long) - 1)/sizeof(value_type) > 2 ? > @@ -706,11 +706,11 @@ private: > }; > > #if _LIBCPP_BIG_ENDIAN > - enum {__short_mask = 0x80}; > - enum {__long_mask = ~(size_type(~0) >> 1)}; > + static const size_type __short_mask = 0x80; > + static const size_type __long_mask = ~(size_type(~0) >> 1); > #else // _LIBCPP_BIG_ENDIAN > - enum {__short_mask = 0x01}; > - enum {__long_mask = 0x1ul}; > + static const size_type __short_mask = 0x01; > + static const size_type __long_mask = 0x1ul; > #endif // _LIBCPP_BIG_ENDIAN > > enum {__min_cap = (sizeof(__long) - 1)/sizeof(value_type) > 2 ? > > > _______________________________________________ > cfe-commits mailing list > cfe-commits@lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits >
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits