[cfe-commits] [libcxx] r164575 - /libcxx/trunk/include/cstddef

Howard Hinnant hhinnant at apple.com
Mon Sep 24 16:36:40 PDT 2012


Author: hhinnant
Date: Mon Sep 24 18:36:40 2012
New Revision: 164575

URL: http://llvm.org/viewvc/llvm-project?rev=164575&view=rev
Log:
Apply the emulated nullptr_t with constexpr.  This is an unusual configuration that would take advantage of this.  But it has popped up in the wild and does no harm to support it.

Modified:
    libcxx/trunk/include/cstddef

Modified: libcxx/trunk/include/cstddef
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/cstddef?rev=164575&r1=164574&r2=164575&view=diff
==============================================================================
--- libcxx/trunk/include/cstddef (original)
+++ libcxx/trunk/include/cstddef Mon Sep 24 18:36:40 2012
@@ -62,28 +62,28 @@
 
     struct __nat {int __for_bool_;};
 
-    _LIBCPP_ALWAYS_INLINE nullptr_t() {}
-    _LIBCPP_ALWAYS_INLINE nullptr_t(int __nat::*) {}
+    _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR nullptr_t() : _(0) {}
+    _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR nullptr_t(int __nat::*) : _(0) {}
 
-    _LIBCPP_ALWAYS_INLINE operator int __nat::*() const {return 0;}
+    _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR operator int __nat::*() const {return 0;}
 
     template <class _Tp>
-        _LIBCPP_ALWAYS_INLINE
+        _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR
         operator _Tp* () const {return 0;}
 
     template <class _Tp, class _Up>
         _LIBCPP_ALWAYS_INLINE
         operator _Tp _Up::* () const {return 0;}
 
-    friend _LIBCPP_ALWAYS_INLINE bool operator==(nullptr_t, nullptr_t) {return true;}
-    friend _LIBCPP_ALWAYS_INLINE bool operator!=(nullptr_t, nullptr_t) {return false;}
-    friend _LIBCPP_ALWAYS_INLINE bool operator<(nullptr_t, nullptr_t) {return false;}
-    friend _LIBCPP_ALWAYS_INLINE bool operator<=(nullptr_t, nullptr_t) {return true;}
-    friend _LIBCPP_ALWAYS_INLINE bool operator>(nullptr_t, nullptr_t) {return false;}
-    friend _LIBCPP_ALWAYS_INLINE bool operator>=(nullptr_t, nullptr_t) {return true;}
+    friend _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR bool operator==(nullptr_t, nullptr_t) {return true;}
+    friend _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR bool operator!=(nullptr_t, nullptr_t) {return false;}
+    friend _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR bool operator<(nullptr_t, nullptr_t) {return false;}
+    friend _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR bool operator<=(nullptr_t, nullptr_t) {return true;}
+    friend _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR bool operator>(nullptr_t, nullptr_t) {return false;}
+    friend _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR bool operator>=(nullptr_t, nullptr_t) {return true;}
 };
 
-inline _LIBCPP_ALWAYS_INLINE nullptr_t __get_nullptr_t() {return nullptr_t(0);}
+inline _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR nullptr_t __get_nullptr_t() {return nullptr_t(0);}
 
 #define nullptr _VSTD::__get_nullptr_t()
 





More information about the cfe-commits mailing list