From c25d158c62f7485c7c3d72aa98bc519e8630c03b Mon Sep 17 00:00:00 2001 From: Howard Hinnant Date: Mon, 24 Sep 2012 23:36:40 +0000 Subject: [PATCH] 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. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@164575 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/cstddef | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/include/cstddef b/include/cstddef index 4a6b16e1..4b01be26 100644 --- a/include/cstddef +++ b/include/cstddef @@ -62,28 +62,28 @@ struct _LIBCPP_VISIBLE nullptr_t 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 - _LIBCPP_ALWAYS_INLINE + _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR operator _Tp* () const {return 0;} template _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()