[libcxx] r292866 - Merge r292833 - Manually force the use of __decltype in C++03 with Clang 3.4.
Eric Fiselier via cfe-commits
cfe-commits at lists.llvm.org
Mon Jan 23 17:01:55 PST 2017
Author: ericwf
Date: Mon Jan 23 19:01:55 2017
New Revision: 292866
URL: http://llvm.org/viewvc/llvm-project?rev=292866&view=rev
Log:
Merge r292833 - Manually force the use of __decltype in C++03 with Clang 3.4.
This merges a version of r292833 since it didn't apply cleanly due to other
upstream changes. Original commit message below:
<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.
Modified:
libcxx/branches/release_40/include/__config
Modified: libcxx/branches/release_40/include/__config
URL: http://llvm.org/viewvc/llvm-project/libcxx/branches/release_40/include/__config?rev=292866&r1=292865&r2=292866&view=diff
==============================================================================
--- libcxx/branches/release_40/include/__config (original)
+++ libcxx/branches/release_40/include/__config Mon Jan 23 19:01:55 2017
@@ -103,6 +103,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)
@@ -111,6 +114,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.
@@ -741,7 +748,7 @@ template <unsigned> struct __static_asse
#ifdef _LIBCPP_HAS_NO_DECLTYPE
// GCC 4.6 provides __decltype in all standard modes.
-#if !__is_identifier(__decltype) || _GNUC_VER >= 406
+#if !__is_identifier(__decltype) || _LIBCPP_CLANG_VER >= 304 || _GNUC_VER >= 406
# define decltype(__x) __decltype(__x)
#else
# define decltype(__x) __typeof__(__x)
More information about the cfe-commits
mailing list