summaryrefslogtreecommitdiffstats
path: root/libcxx
diff options
context:
space:
mode:
authorEric Fiselier <eric@efcs.ca>2017-01-23 21:41:13 +0000
committerEric Fiselier <eric@efcs.ca>2017-01-23 21:41:13 +0000
commit014d9491ffd349d5488710564333deb99639dc16 (patch)
treeecdc50365a16123559f05f294b69163146d0d401 /libcxx
parent5363be7a9cd4a6d86973eabb593456fd25cb635b (diff)
downloadbcm5719-llvm-014d9491ffd349d5488710564333deb99639dc16.tar.gz
bcm5719-llvm-014d9491ffd349d5488710564333deb99639dc16.zip
Manually force the use of __decltype in C++03 with Clang 3.4.
<string> uses `decltype` in a way incompatible with `__typeof__`. This is problematic when compiling <string> with Clang 3.4 because even though it provides `__decltype` libc++ still used `__typeof__` because clang 3.4 doesn't provide __is_identifier which libc++ uses to detect __decltype. This patch manually detects Clang 3.4 and properly configures for it. llvm-svn: 292833
Diffstat (limited to 'libcxx')
-rw-r--r--libcxx/include/__config9
1 files changed, 8 insertions, 1 deletions
diff --git a/libcxx/include/__config b/libcxx/include/__config
index 9585f33c023..44f1344d571 100644
--- a/libcxx/include/__config
+++ b/libcxx/include/__config
@@ -109,6 +109,9 @@
#if defined(__clang__)
#define _LIBCPP_COMPILER_CLANG
+# ifndef __apple_build_version__
+# define _LIBCPP_CLANG_VER (__clang_major__ * 100 + __clang_minor__)
+# endif
#elif defined(__GNUC__)
#define _LIBCPP_COMPILER_GCC
#elif defined(_MSC_VER)
@@ -117,6 +120,10 @@
#define _LIBCPP_COMPILER_IBM
#endif
+#ifndef _LIBCPP_CLANG_VER
+#define _LIBCPP_CLANG_VER 0
+#endif
+
// FIXME: ABI detection should be done via compiler builtin macros. This
// is just a placeholder until Clang implements such macros. For now assume
// that Windows compilers pretending to be MSVC++ target the microsoft ABI.
@@ -754,7 +761,7 @@ template <unsigned> struct __static_assert_check {};
#ifdef _LIBCPP_HAS_NO_DECLTYPE
// GCC 4.6 provides __decltype in all standard modes.
-#if __has_keyword(__decltype) || _GNUC_VER >= 406
+#if __has_keyword(__decltype) || _LIBCPP_CLANG_VER >= 304 || _GNUC_VER >= 406
# define decltype(__x) __decltype(__x)
#else
# define decltype(__x) __typeof__(__x)
OpenPOWER on IntegriCloud