[PATCH] [libcxx] Use __decltype instead of __typeof__
Eric Fiselier
eric at efcs.ca
Fri Jun 12 23:17:51 PDT 2015
@mclow.lists expressed concern about the _CLANG_VER macro so I removed it.
I also properly handle Apple clang's version numbers. __decltype is enabled for XCode 5.0 (based off of LLVM 3.3) and greater.
http://reviews.llvm.org/D10426
Files:
include/__config
Index: include/__config
===================================================================
--- include/__config
+++ include/__config
@@ -577,7 +577,22 @@
#endif // _LIBCPP_HAS_NO_STATIC_ASSERT
#ifdef _LIBCPP_HAS_NO_DECLTYPE
-#define decltype(x) __typeof__(x)
+# if defined(__clang__)
+# define _CLANG_VER (__clang_major__ * 100 + __clang_minor__)
+# else
+# define _CLANG_VER 0
+# endif
+// Clang 3.0 and GCC 4.6 provide __decltype in all standard modes.
+// XCode 5.0 is based off of Clang 3.3 SVN. We require Clang 3.3
+// be sure we have __decltype.
+#if (defined(__apple_build_version__) && _CLANG_VER >= 500) || \
+ (!defined(__apple_build_version__) && _CLANG_VER >= 303) || \
+ _GNUC_VER >= 406
+# define decltype(__x) __decltype(__x)
+#else
+# define decltype(__x) __typeof__(__x)
+#endif
+#undef _CLANG_VER
#endif
#ifdef _LIBCPP_HAS_NO_CONSTEXPR
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D10426.27631.patch
Type: text/x-patch
Size: 875 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150613/1781614d/attachment.bin>
More information about the cfe-commits
mailing list