[PATCH] D17132: [libcxx] Fix definition of regex_traits::__regex_word on big-endian glibc systems

Daniel Sanders via cfe-commits cfe-commits at lists.llvm.org
Thu Feb 11 02:17:10 PST 2016


dsanders added inline comments.

================
Comment at: include/regex:980
@@ +979,3 @@
+#if defined(__GLIBC__)
+    static const char_class_type __regex_word = static_cast<char_class_type>(_ISbit(15));
+#else
----------------
The static_cast is necessary to silence a false-positive warning on little-endian. _ISbit(15) expands to:
  ((15) < 8 ? ((1 << (15)) << 8) : ((1 << (15)) >> 8))
which simplifies to:
  0 ? 0x800000 : 0x80
Clang warns about the truncation of the 0x800000 to char_class_type (unsigned short) even though this value doesn't matter.



http://reviews.llvm.org/D17132





More information about the cfe-commits mailing list