[libcxx-commits] [libcxx] 74494d9 - [libc++] Don't use __is_fundamental in C++03 mode

via libcxx-commits libcxx-commits at lists.llvm.org
Thu Mar 19 10:49:04 PDT 2020


Author: zoecarver
Date: 2020-03-19T10:48:52-07:00
New Revision: 74494d9992bdf266259f8add410f346971471c46

URL: https://github.com/llvm/llvm-project/commit/74494d9992bdf266259f8add410f346971471c46
DIFF: https://github.com/llvm/llvm-project/commit/74494d9992bdf266259f8add410f346971471c46.diff

LOG: [libc++] Don't use __is_fundamental in C++03 mode

In C++03 mode, nullptr is defined by libc++, not the compiler so, we can't use __is_fundamental (because it will return false for nullptr).

Fixes: 5ade17e0ca8b11f57cb15a1bee6d30a3815d8cac

Added: 
    

Modified: 
    libcxx/include/type_traits

Removed: 
    


################################################################################
diff  --git a/libcxx/include/type_traits b/libcxx/include/type_traits
index fc840ce7b3c0..52b8dab31732 100644
--- a/libcxx/include/type_traits
+++ b/libcxx/include/type_traits
@@ -1218,8 +1218,9 @@ _LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_arithmetic_v
 
 // is_fundamental
 
-// In clang 9 and lower, this builtin did not work for nullptr_t
-#if __has_keyword(__is_fundamental) && _LIBCPP_CLANG_VER > 900
+// In clang 9 and lower, this builtin did not work for nullptr_t. Additionally, in C++03 mode,
+// nullptr isn't defined by the compiler so, this builtin won't work.
+#if __has_keyword(__is_fundamental) && _LIBCPP_CLANG_VER > 900 && !defined(_LIBCPP_CXX03_LANG)
 
 template<class _Tp>
 struct _LIBCPP_TEMPLATE_VIS is_fundamental : _BoolConstant<__is_fundamental(_Tp)> { };


        


More information about the libcxx-commits mailing list