[cfe-commits] [libcxx] r132406 - /libcxx/trunk/include/type_traits

Howard Hinnant hhinnant at apple.com
Wed Jun 1 10:25:11 PDT 2011


Author: hhinnant
Date: Wed Jun  1 12:25:11 2011
New Revision: 132406

URL: http://llvm.org/viewvc/llvm-project?rev=132406&view=rev
Log:
Turning on cxx_nullptr exposed a latent bug in is_function, causing nullptr to wrongly classify as a function.  Fixed.

Modified:
    libcxx/trunk/include/type_traits

Modified: libcxx/trunk/include/type_traits
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/type_traits?rev=132406&r1=132405&r2=132406&view=diff
==============================================================================
--- libcxx/trunk/include/type_traits (original)
+++ libcxx/trunk/include/type_traits Wed Jun  1 12:25:11 2011
@@ -328,6 +328,11 @@
 
 #endif
 
+// is_same
+
+template <class _Tp, class _Up> struct _LIBCPP_VISIBLE is_same           : public false_type {};
+template <class _Tp>            struct _LIBCPP_VISIBLE is_same<_Tp, _Tp> : public true_type {};
+
 // is_function
 
 namespace __is_function_imp
@@ -340,7 +345,8 @@
 template <class _Tp, bool = is_class<_Tp>::value ||
                             is_union<_Tp>::value ||
                             is_void<_Tp>::value  ||
-                            is_reference<_Tp>::value>
+                            is_reference<_Tp>::value ||
+                            is_same<_Tp, nullptr_t>::value >
 struct __is_function
     : public integral_constant<bool, sizeof(__is_function_imp::__test<_Tp>(__is_function_imp::__source<_Tp>())) == 1>
     {};
@@ -591,11 +597,6 @@
 template <class _Tp, size_t _Np> struct _LIBCPP_VISIBLE remove_all_extents<_Tp[_Np]>
     {typedef typename remove_all_extents<_Tp>::type type;};
 
-// is_same
-
-template <class _Tp, class _Up> struct _LIBCPP_VISIBLE is_same           : public false_type {};
-template <class _Tp>            struct _LIBCPP_VISIBLE is_same<_Tp, _Tp> : public true_type {};
-
 // is_abstract
 
 namespace __is_abstract_imp





More information about the cfe-commits mailing list