--- src/util.h.orig	2017-01-05 15:05:24.000000000 -0600
+++ src/util.h	2017-02-11 00:41:28.000000000 -0600
@@ -8,7 +8,13 @@
 #include <stddef.h>
 #include <stdlib.h>
 
-#ifdef __APPLE__
+// libc++ provides a C++11 <type_traits> header.
+#include <ciso646>
+#if defined(__APPLE__) && !defined(_LIBCPP_VERSION)
+#define USE_TR1_TYPE_TRAITS
+#endif
+
+#ifdef USE_TR1_TYPE_TRAITS
 #include <tr1/type_traits>  // NOLINT(build/c++tr1)
 #else
 #include <type_traits>  // std::remove_reference
@@ -27,7 +33,7 @@
 inline void* Malloc(size_t size);
 inline void* Calloc(size_t n, size_t size);
 
-#ifdef __APPLE__
+#ifdef USE_TR1_TYPE_TRAITS
 template <typename T> using remove_reference = std::tr1::remove_reference<T>;
 #else
 template <typename T> using remove_reference = std::remove_reference<T>;