about summary refs log tree commit diff
path: root/absl
diff options
context:
space:
mode:
Diffstat (limited to 'absl')
-rw-r--r--absl/memory/memory.h6
-rw-r--r--absl/strings/internal/str_format/float_conversion.cc9
2 files changed, 13 insertions, 2 deletions
diff --git a/absl/memory/memory.h b/absl/memory/memory.h
index c43e156682fd..f207169a6885 100644
--- a/absl/memory/memory.h
+++ b/absl/memory/memory.h
@@ -83,7 +83,11 @@ struct MakeUniqueResult<T[N]> {
 
 }  // namespace memory_internal
 
-#if __cplusplus >= 201402L || defined(_MSC_VER)
+// gcc 4.8 has __cplusplus at 201301 but doesn't define make_unique.  Other
+// supported compilers either just define __cplusplus as 201103 but have
+// make_unique (msvc), or have make_unique whenever __cplusplus > 201103 (clang)
+#if (__cplusplus > 201103L || defined(_MSC_VER)) && \
+    !(defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ == 8)
 using std::make_unique;
 #else
 // -----------------------------------------------------------------------------
diff --git a/absl/strings/internal/str_format/float_conversion.cc b/absl/strings/internal/str_format/float_conversion.cc
index 37952b4699e9..6176db9cb5a2 100644
--- a/absl/strings/internal/str_format/float_conversion.cc
+++ b/absl/strings/internal/str_format/float_conversion.cc
@@ -153,7 +153,14 @@ void PrintExponent(int exp, char e, Buffer *out) {
 
 template <typename Float, typename Int>
 constexpr bool CanFitMantissa() {
-  return std::numeric_limits<Float>::digits <= std::numeric_limits<Int>::digits;
+  return
+#if defined(__clang__) && !defined(__SSE3__)
+      // Workaround for clang bug: https://bugs.llvm.org/show_bug.cgi?id=38289
+      // Casting from long double to uint64_t is miscompiled and drops bits.
+      (!std::is_same<Float, long double>::value ||
+       !std::is_same<Int, uint64_t>::value) &&
+#endif
+      std::numeric_limits<Float>::digits <= std::numeric_limits<Int>::digits;
 }
 
 template <typename Float>