Index: libcxx/include/__atomic/is_always_lock_free.h =================================================================== --- libcxx/include/__atomic/is_always_lock_free.h +++ libcxx/include/__atomic/is_always_lock_free.h @@ -20,7 +20,7 @@ template struct __libcpp_is_always_lock_free { // __atomic_always_lock_free is available in all Standard modes - static const bool __value = __atomic_always_lock_free(sizeof(_Tp), 0); + static const bool __value = __atomic_always_lock_free(sizeof(_Tp), nullptr); }; _LIBCPP_END_NAMESPACE_STD Index: libcxx/include/__compare/ordering.h =================================================================== --- libcxx/include/__compare/ordering.h +++ libcxx/include/__compare/ordering.h @@ -39,9 +39,15 @@ template inline constexpr bool __one_of_v = (is_same_v<_Tp, _Args> || ...); +void __literal_zero_is_expected(); + struct _CmpUnspecifiedParam { - _LIBCPP_HIDE_FROM_ABI constexpr - _CmpUnspecifiedParam(int _CmpUnspecifiedParam::*) noexcept {} + consteval + _CmpUnspecifiedParam(int __literal_zero) noexcept { + if (__literal_zero != 0) { + __literal_zero_is_expected(); + } + } template>> _CmpUnspecifiedParam(_Tp) = delete; Index: libcxx/include/__functional/weak_result_type.h =================================================================== --- libcxx/include/__functional/weak_result_type.h +++ libcxx/include/__functional/weak_result_type.h @@ -47,8 +47,8 @@ __test(const volatile __unary_function<_Ap, _Rp>*); public: - static const bool value = !is_same::value; - typedef decltype(__test((_Tp*)0)) type; + static const bool value = !is_same::value; + typedef decltype(__test((_Tp*)nullptr)) type; }; template @@ -62,8 +62,8 @@ __test(const volatile __binary_function<_A1, _A2, _Rp>*); public: - static const bool value = !is_same::value; - typedef decltype(__test((_Tp*)0)) type; + static const bool value = !is_same::value; + typedef decltype(__test((_Tp*)nullptr)) type; }; template ::value> Index: libcxx/include/__iterator/iterator_traits.h =================================================================== --- libcxx/include/__iterator/iterator_traits.h +++ libcxx/include/__iterator/iterator_traits.h @@ -133,7 +133,7 @@ __void_t* = nullptr, __void_t* = nullptr); public: - static const bool value = decltype(__test<_Tp>(0,0,0,0,0))::value; + static const bool value = decltype(__test<_Tp>(nullptr,nullptr,nullptr,nullptr,nullptr))::value; }; Index: libcxx/include/__memory/unique_ptr.h =================================================================== --- libcxx/include/__memory/unique_ptr.h +++ libcxx/include/__memory/unique_ptr.h @@ -57,7 +57,7 @@ #endif template _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 default_delete( - const default_delete<_Up>&, typename enable_if::value>::type* = 0) _NOEXCEPT {} + const default_delete<_Up>&, typename enable_if::value>::type* = nullptr) _NOEXCEPT {} _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 void operator()(_Tp* __ptr) const _NOEXCEPT { static_assert(sizeof(_Tp) >= 0, "cannot delete an incomplete type"); @@ -82,7 +82,7 @@ template _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 - default_delete(const default_delete<_Up[]>&, typename _EnableIfConvertible<_Up>::type* = 0) _NOEXCEPT {} + default_delete(const default_delete<_Up[]>&, typename _EnableIfConvertible<_Up>::type* = nullptr) _NOEXCEPT {} template _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 typename _EnableIfConvertible<_Up>::type Index: libcxx/include/__memory/uses_allocator.h =================================================================== --- libcxx/include/__memory/uses_allocator.h +++ libcxx/include/__memory/uses_allocator.h @@ -25,9 +25,9 @@ { private: template static false_type __test(...); - template static true_type __test(typename _Up::allocator_type* = 0); + template static true_type __test(typename _Up::allocator_type* = nullptr); public: - static const bool value = decltype(__test<_Tp>(0))::value; + static const bool value = decltype(__test<_Tp>(nullptr))::value; }; template ::value> Index: libcxx/include/locale =================================================================== --- libcxx/include/locale +++ libcxx/include/locale @@ -3984,7 +3984,7 @@ wbuffer_convert<_Codecvt, _Elem, _Tr>::underflow() { _LIBCPP_SUPPRESS_DEPRECATED_POP - if (__cv_ == 0 || __bufptr_ == 0) + if (__cv_ == 0 || __bufptr_ == nullptr) return traits_type::eof(); bool __initial = __read_mode(); char_type __1buf; @@ -4056,7 +4056,7 @@ wbuffer_convert<_Codecvt, _Elem, _Tr>::pbackfail(int_type __c) { _LIBCPP_SUPPRESS_DEPRECATED_POP - if (__cv_ != 0 && __bufptr_ != 0 && this->eback() < this->gptr()) + if (__cv_ != 0 && __bufptr_ != nullptr && this->eback() < this->gptr()) { if (traits_type::eq_int_type(__c, traits_type::eof())) { @@ -4079,7 +4079,7 @@ wbuffer_convert<_Codecvt, _Elem, _Tr>::overflow(int_type __c) { _LIBCPP_SUPPRESS_DEPRECATED_POP - if (__cv_ == 0 || __bufptr_ == 0) + if (__cv_ == 0 || __bufptr_ == nullptr) return traits_type::eof(); __write_mode(); char_type __1buf; @@ -4199,7 +4199,7 @@ ios_base::openmode __om) { int __width = __cv_->encoding(); - if (__cv_ == 0 || __bufptr_ == 0 || (__width <= 0 && __off != 0) || sync()) + if (__cv_ == 0 || __bufptr_ == nullptr || (__width <= 0 && __off != 0) || sync()) return pos_type(off_type(-1)); // __width > 0 || __off == 0, now check __way if (__way != ios_base::beg && __way != ios_base::cur && __way != ios_base::end) @@ -4213,7 +4213,7 @@ typename wbuffer_convert<_Codecvt, _Elem, _Tr>::pos_type wbuffer_convert<_Codecvt, _Elem, _Tr>::seekpos(pos_type __sp, ios_base::openmode __wch) { - if (__cv_ == 0 || __bufptr_ == 0 || sync()) + if (__cv_ == 0 || __bufptr_ == nullptr || sync()) return pos_type(off_type(-1)); if (__bufptr_->pubseekpos(__sp, __wch) == pos_type(off_type(-1))) return pos_type(off_type(-1)); @@ -4225,7 +4225,7 @@ wbuffer_convert<_Codecvt, _Elem, _Tr>::sync() { _LIBCPP_SUPPRESS_DEPRECATED_POP - if (__cv_ == 0 || __bufptr_ == 0) + if (__cv_ == 0 || __bufptr_ == nullptr) return 0; if (__cm_ & ios_base::out) { Index: libcxx/test/libcxx/language.support/cmp/cmp.categories.pre/zero_type.verify.cpp =================================================================== --- libcxx/test/libcxx/language.support/cmp/cmp.categories.pre/zero_type.verify.cpp +++ libcxx/test/libcxx/language.support/cmp/cmp.categories.pre/zero_type.verify.cpp @@ -8,10 +8,6 @@ // UNSUPPORTED: c++03, c++11, c++14, c++17 -// In MSVC mode, there's a slightly different number of errors printed for -// each of these, so it doesn't add up to the exact expected count of 18. -// XFAIL: msvc - // // Ensure we reject all cases where an argument other than a literal 0 is used @@ -23,9 +19,7 @@ void(v op 0L); \ void(0L op v); \ void(v op nullptr); \ - void(nullptr op v); \ - void(v op(1 - 1)); \ - void((1 - 1) op v) + void(nullptr op v) #define TEST_PASS(v, op) \ void(v op 0); \ @@ -33,13 +27,13 @@ template void test_category(T v) { - TEST_FAIL(v, ==); // expected-error 18 {{}} - TEST_FAIL(v, !=); // expected-error 18 {{}} - TEST_FAIL(v, <); // expected-error 18 {{}} - TEST_FAIL(v, <=); // expected-error 18 {{}} - TEST_FAIL(v, >); // expected-error 18 {{}} - TEST_FAIL(v, >=); // expected-error 18 {{}} - TEST_FAIL(v, <=>); // expected-error 18 {{}} + TEST_FAIL(v, ==); // expected-error 12 {{}} + TEST_FAIL(v, !=); // expected-error 12 {{}} + TEST_FAIL(v, <); // expected-error 12 {{}} + TEST_FAIL(v, <=); // expected-error 12 {{}} + TEST_FAIL(v, >); // expected-error 12 {{}} + TEST_FAIL(v, >=); // expected-error 12 {{}} + TEST_FAIL(v, <=>); // expected-error 12 {{}} TEST_PASS(v, ==); TEST_PASS(v, !=); Index: libcxx/test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.cons/assignment.compile.fail.cpp =================================================================== --- libcxx/test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.cons/assignment.compile.fail.cpp +++ libcxx/test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.cons/assignment.compile.fail.cpp @@ -31,7 +31,7 @@ std::auto_ptr& apr = ap2 = ap1; assert(&apr == &ap2); assert(A::count == 1); - assert(ap1.get() == 0); + assert(ap1.get() == nullptr); assert(ap2.get() == p1); } assert(A::count == 0); Index: libcxx/test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.cons/assignment.pass.cpp =================================================================== --- libcxx/test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.cons/assignment.pass.cpp +++ libcxx/test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.cons/assignment.pass.cpp @@ -35,7 +35,7 @@ std::auto_ptr& apr = ap2 = ap1; assert(&apr == &ap2); assert(A::count == 1); - assert(ap1.get() == 0); + assert(ap1.get() == nullptr); assert(ap2.get() == p1); } assert(A::count == 0); Index: libcxx/test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.cons/convert.compile.fail.cpp =================================================================== --- libcxx/test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.cons/convert.compile.fail.cpp +++ libcxx/test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.cons/convert.compile.fail.cpp @@ -24,7 +24,7 @@ B* p = new B(1); const std::auto_ptr ap1(p); std::auto_ptr ap2(ap1); - assert(ap1.get() == 0); + assert(ap1.get() == nullptr); assert(ap2.get() == p); assert(A::count == 1); assert(B::count == 1); Index: libcxx/test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.cons/convert.pass.cpp =================================================================== --- libcxx/test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.cons/convert.pass.cpp +++ libcxx/test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.cons/convert.pass.cpp @@ -28,7 +28,7 @@ B* p = new B(1); std::auto_ptr ap1(p); std::auto_ptr ap2(ap1); - assert(ap1.get() == 0); + assert(ap1.get() == nullptr); assert(ap2.get() == p); assert(A::count == 1); assert(B::count == 1); Index: libcxx/test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.cons/convert_assignment.compile.fail.cpp =================================================================== --- libcxx/test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.cons/convert_assignment.compile.fail.cpp +++ libcxx/test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.cons/convert_assignment.compile.fail.cpp @@ -35,7 +35,7 @@ assert(&apr == &ap2); assert(A::count == 1); assert(B::count == 1); - assert(ap1.get() == 0); + assert(ap1.get() == nullptr); assert(ap2.get() == p1); } assert(A::count == 0); Index: libcxx/test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.cons/convert_assignment.pass.cpp =================================================================== --- libcxx/test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.cons/convert_assignment.pass.cpp +++ libcxx/test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.cons/convert_assignment.pass.cpp @@ -37,7 +37,7 @@ assert(&apr == &ap2); assert(A::count == 1); assert(B::count == 1); - assert(ap1.get() == 0); + assert(ap1.get() == nullptr); assert(ap2.get() == p1); } assert(A::count == 0); Index: libcxx/test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.cons/copy.compile.fail.cpp =================================================================== --- libcxx/test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.cons/copy.compile.fail.cpp +++ libcxx/test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.cons/copy.compile.fail.cpp @@ -26,7 +26,7 @@ A* p = new A(1); const std::auto_ptr ap1(p); std::auto_ptr ap2(ap1); - assert(ap1.get() == 0); + assert(ap1.get() == nullptr); assert(ap2.get() == p); assert(A::count == 1); } Index: libcxx/test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.cons/copy.pass.cpp =================================================================== --- libcxx/test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.cons/copy.pass.cpp +++ libcxx/test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.cons/copy.pass.cpp @@ -28,7 +28,7 @@ A* p = new A(1); std::auto_ptr ap1(p); std::auto_ptr ap2(ap1); - assert(ap1.get() == 0); + assert(ap1.get() == nullptr); assert(ap2.get() == p); assert(A::count == 1); } Index: libcxx/test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.cons/explicit.compile.fail.cpp =================================================================== --- libcxx/test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.cons/explicit.compile.fail.cpp +++ libcxx/test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.cons/explicit.compile.fail.cpp @@ -31,7 +31,7 @@ assert(A::count == 0); { std::auto_ptr ap; - assert(ap.get() == 0); + assert(ap.get() == nullptr); } } Index: libcxx/test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.cons/pointer.pass.cpp =================================================================== --- libcxx/test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.cons/pointer.pass.cpp +++ libcxx/test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.cons/pointer.pass.cpp @@ -33,7 +33,7 @@ assert(A::count == 0); { std::auto_ptr ap; - assert(ap.get() == 0); + assert(ap.get() == nullptr); } } Index: libcxx/test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.conv/assign_from_auto_ptr_ref.pass.cpp =================================================================== --- libcxx/test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.conv/assign_from_auto_ptr_ref.pass.cpp +++ libcxx/test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.conv/assign_from_auto_ptr_ref.pass.cpp @@ -32,7 +32,7 @@ ap2 = apr; assert(A::count == 1); assert(ap2.get() == p1); - assert(ap1.get() == 0); + assert(ap1.get() == nullptr); } assert(A::count == 0); } Index: libcxx/test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.conv/convert_from_auto_ptr_ref.pass.cpp =================================================================== --- libcxx/test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.conv/convert_from_auto_ptr_ref.pass.cpp +++ libcxx/test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.conv/convert_from_auto_ptr_ref.pass.cpp @@ -30,7 +30,7 @@ std::auto_ptr_ref apr = ap1; std::auto_ptr ap2(apr); assert(ap2.get() == p1); - assert(ap1.get() == 0); + assert(ap1.get() == nullptr); } assert(A::count == 0); assert(B::count == 0); Index: libcxx/test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.members/release.pass.cpp =================================================================== --- libcxx/test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.members/release.pass.cpp +++ libcxx/test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.members/release.pass.cpp @@ -29,7 +29,7 @@ std::auto_ptr ap(p); A* p2 = ap.release(); assert(p2 == p); - assert(ap.get() == 0); + assert(ap.get() == nullptr); delete p; } assert(A::count == 0); Index: libcxx/test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.members/reset.pass.cpp =================================================================== --- libcxx/test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.members/reset.pass.cpp +++ libcxx/test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.members/reset.pass.cpp @@ -28,7 +28,7 @@ A* p = new A(1); std::auto_ptr ap(p); ap.reset(); - assert(ap.get() == 0); + assert(ap.get() == nullptr); assert(A::count == 0); } assert(A::count == 0); Index: libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.assign/auto_ptr_Y.pass.cpp =================================================================== --- libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.assign/auto_ptr_Y.pass.cpp +++ libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.assign/auto_ptr_Y.pass.cpp @@ -55,7 +55,7 @@ assert(B::count == 1); assert(A::count == 1); assert(pB.use_count() == 1); - assert(pA.get() == 0); + assert(pA.get() == nullptr); assert(pB.get() == ptrA); } assert(B::count == 0); @@ -72,7 +72,7 @@ assert(B::count == 0); assert(A::count == 0); assert(pB.use_count() == 1); - assert(pA.get() == 0); + assert(pA.get() == nullptr); assert(pB.get() == ptrA); } assert(B::count == 0); @@ -89,7 +89,7 @@ assert(B::count == 1); assert(A::count == 1); assert(pB.use_count() == 1); - assert(pA.get() == 0); + assert(pA.get() == nullptr); assert(pB.get() == ptrA); } assert(B::count == 0); @@ -106,7 +106,7 @@ assert(B::count == 0); assert(A::count == 0); assert(pB.use_count() == 1); - assert(pA.get() == 0); + assert(pA.get() == nullptr); assert(pB.get() == ptrA); } assert(B::count == 0); Index: libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.assign/shared_ptr_Y_rv.pass.cpp =================================================================== --- libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.assign/shared_ptr_Y_rv.pass.cpp +++ libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.assign/shared_ptr_Y_rv.pass.cpp @@ -56,7 +56,7 @@ assert(A::count == 1); assert(pB.use_count() == 1); assert(pA.use_count() == 0); - assert(pA.get() == 0); + assert(pA.get() == nullptr); assert(pB.get() == ptrA); } assert(pA.use_count() == 0); @@ -75,7 +75,7 @@ assert(A::count == 0); assert(pB.use_count() == 0); assert(pA.use_count() == 0); - assert(pA.get() == 0); + assert(pA.get() == nullptr); assert(pB.get() == ptrA); } assert(pA.use_count() == 0); @@ -94,7 +94,7 @@ assert(A::count == 1); assert(pB.use_count() == 1); assert(pA.use_count() == 0); - assert(pA.get() == 0); + assert(pA.get() == nullptr); assert(pB.get() == ptrA); } assert(pA.use_count() == 0); @@ -113,7 +113,7 @@ assert(A::count == 0); assert(pB.use_count() == 0); assert(pA.use_count() == 0); - assert(pA.get() == 0); + assert(pA.get() == nullptr); assert(pB.get() == ptrA); } assert(pA.use_count() == 0); Index: libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.assign/shared_ptr_rv.pass.cpp =================================================================== --- libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.assign/shared_ptr_rv.pass.cpp +++ libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.assign/shared_ptr_rv.pass.cpp @@ -56,7 +56,7 @@ assert(A::count == 1); assert(pB.use_count() == 1); assert(pA.use_count() == 0); - assert(pA.get() == 0); + assert(pA.get() == nullptr); assert(pB.get() == ptrA); } assert(pA.use_count() == 0); @@ -75,7 +75,7 @@ assert(A::count == 0); assert(pB.use_count() == 0); assert(pA.use_count() == 0); - assert(pA.get() == 0); + assert(pA.get() == nullptr); assert(pB.get() == ptrA); } assert(pA.use_count() == 0); @@ -94,7 +94,7 @@ assert(A::count == 1); assert(pB.use_count() == 1); assert(pA.use_count() == 0); - assert(pA.get() == 0); + assert(pA.get() == nullptr); assert(pB.get() == ptrA); } assert(pA.use_count() == 0); @@ -113,7 +113,7 @@ assert(A::count == 0); assert(pB.use_count() == 0); assert(pA.use_count() == 0); - assert(pA.get() == 0); + assert(pA.get() == nullptr); assert(pB.get() == ptrA); } assert(pA.use_count() == 0); Index: libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.assign/unique_ptr_Y.pass.cpp =================================================================== --- libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.assign/unique_ptr_Y.pass.cpp +++ libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.assign/unique_ptr_Y.pass.cpp @@ -76,7 +76,7 @@ assert(B::count == 1); assert(A::count == 1); assert(pB.use_count() == 1); - assert(pA.get() == 0); + assert(pA.get() == nullptr); assert(pB.get() == ptrA); } assert(B::count == 0); @@ -93,7 +93,7 @@ assert(B::count == 0); assert(A::count == 0); // assert(pB.use_count() == 1); // no longer true due to LWG 2415 - assert(pA.get() == 0); + assert(pA.get() == nullptr); assert(pB.get() == ptrA); } assert(B::count == 0); @@ -110,7 +110,7 @@ assert(B::count == 1); assert(A::count == 1); assert(pB.use_count() == 1); - assert(pA.get() == 0); + assert(pA.get() == nullptr); assert(pB.get() == ptrA); } assert(B::count == 0); @@ -127,7 +127,7 @@ assert(B::count == 0); assert(A::count == 0); // assert(pB.use_count() == 1); // no longer true due to LWG 2415 - assert(pA.get() == 0); + assert(pA.get() == nullptr); assert(pB.get() == ptrA); } assert(B::count == 0); @@ -156,7 +156,7 @@ assert(A::count == 8); assert(p.use_count() == 1); assert(p.get() == raw_ptr); - assert(ptr.get() == 0); + assert(ptr.get() == nullptr); } assert(A::count == 0); Index: libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.cast/dynamic_pointer_cast.pass.cpp =================================================================== --- libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.cast/dynamic_pointer_cast.pass.cpp +++ libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.cast/dynamic_pointer_cast.pass.cpp @@ -54,14 +54,14 @@ { const std::shared_ptr pB(new B); std::shared_ptr pA = std::dynamic_pointer_cast(pB); - assert(pA.get() == 0); + assert(pA.get() == nullptr); assert(pA.use_count() == 0); } #if TEST_STD_VER > 14 { const std::shared_ptr pB(new B[8]); std::shared_ptr pA = std::dynamic_pointer_cast(pB); - assert(pA.get() == 0); + assert(pA.get() == nullptr); assert(pA.use_count() == 0); } #endif // TEST_STD_VER > 14 Index: libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/auto_ptr.pass.cpp =================================================================== --- libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/auto_ptr.pass.cpp +++ libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/auto_ptr.pass.cpp @@ -55,7 +55,7 @@ assert(B::count == 1); assert(p.use_count() == 1); assert(p.get() == raw_ptr); - assert(ptr.get() == 0); + assert(ptr.get() == nullptr); } assert(A::count == 0); assert(globalMemCounter.checkOutstandingNewEq(0)); @@ -69,7 +69,7 @@ assert(B::count == 1); assert(p.use_count() == 1); assert(p.get() == raw_ptr); - assert(ptr.get() == 0); + assert(ptr.get() == nullptr); } assert(A::count == 0); assert(globalMemCounter.checkOutstandingNewEq(0)); Index: libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/default.pass.cpp =================================================================== --- libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/default.pass.cpp +++ libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/default.pass.cpp @@ -21,7 +21,7 @@ void test() { std::shared_ptr p; assert(p.use_count() == 0); - assert(p.get() == 0); + assert(p.get() == nullptr); } int main(int, char**) { Index: libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/nullptr_t.pass.cpp =================================================================== --- libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/nullptr_t.pass.cpp +++ libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/nullptr_t.pass.cpp @@ -20,13 +20,13 @@ { std::shared_ptr p(nullptr); assert(p.use_count() == 0); - assert(p.get() == 0); + assert(p.get() == nullptr); } { std::shared_ptr p(nullptr); assert(p.use_count() == 0); - assert(p.get() == 0); + assert(p.get() == nullptr); } return 0; Index: libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/nullptr_t_deleter.pass.cpp =================================================================== --- libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/nullptr_t_deleter.pass.cpp +++ libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/nullptr_t_deleter.pass.cpp @@ -34,7 +34,7 @@ std::shared_ptr p(nullptr, test_deleter(3)); assert(A::count == 0); assert(p.use_count() == 1); - assert(p.get() == 0); + assert(p.get() == nullptr); assert(test_deleter::count == 1); assert(test_deleter::dealloc_count == 0); #ifndef TEST_HAS_NO_RTTI Index: libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/nullptr_t_deleter_allocator.pass.cpp =================================================================== --- libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/nullptr_t_deleter_allocator.pass.cpp +++ libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/nullptr_t_deleter_allocator.pass.cpp @@ -35,7 +35,7 @@ std::shared_ptr p(nullptr, test_deleter(3), test_allocator(5, &alloc_stats)); assert(A::count == 0); assert(p.use_count() == 1); - assert(p.get() == 0); + assert(p.get() == nullptr); assert(test_deleter::count == 1); assert(test_deleter::dealloc_count == 0); #ifndef TEST_HAS_NO_RTTI @@ -58,7 +58,7 @@ std::shared_ptr p(nullptr, test_deleter(1), bare_allocator()); assert(A::count == 0); assert(p.use_count() == 1); - assert(p.get() == 0); + assert(p.get() == nullptr); assert(test_deleter::count ==1); assert(test_deleter::dealloc_count == 0); #ifndef TEST_HAS_NO_RTTI @@ -78,7 +78,7 @@ std::shared_ptr p(nullptr, test_deleter(1), min_allocator()); assert(A::count == 0); assert(p.use_count() == 1); - assert(p.get() == 0); + assert(p.get() == nullptr); assert(test_deleter::count ==1); assert(test_deleter::dealloc_count == 0); #ifndef TEST_HAS_NO_RTTI Index: libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/unique_ptr.pass.cpp =================================================================== --- libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/unique_ptr.pass.cpp +++ libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/unique_ptr.pass.cpp @@ -110,7 +110,7 @@ assert(B::count == 1); assert(p.use_count() == 1); assert(p.get() == raw_ptr); - assert(ptr.get() == 0); + assert(ptr.get() == nullptr); } { @@ -121,7 +121,7 @@ assert(B::count == 1); assert(p.use_count() == 1); assert(p.get() == raw_ptr); - assert(ptr.get() == 0); + assert(ptr.get() == nullptr); } #ifndef TEST_HAS_NO_EXCEPTIONS @@ -148,7 +148,7 @@ { std::unique_ptr ptr; std::shared_ptr p(std::move(ptr)); - assert(p.get() == 0); + assert(p.get() == nullptr); assert(p.use_count() == 0); } #endif @@ -198,7 +198,7 @@ assert(A::count == 8); assert(p.use_count() == 1); assert(p.get() == raw_ptr); - assert(ptr.get() == 0); + assert(ptr.get() == nullptr); } assert(A::count == 0); Index: libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.mod/reset.pass.cpp =================================================================== --- libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.mod/reset.pass.cpp +++ libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.mod/reset.pass.cpp @@ -48,7 +48,7 @@ assert(A::count == 0); assert(B::count == 0); assert(p.use_count() == 0); - assert(p.get() == 0); + assert(p.get() == nullptr); } assert(A::count == 0); { @@ -57,7 +57,7 @@ assert(A::count == 0); assert(B::count == 0); assert(p.use_count() == 0); - assert(p.get() == 0); + assert(p.get() == nullptr); } assert(A::count == 0); Index: libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.weak.obs/lock.pass.cpp =================================================================== --- libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.weak.obs/lock.pass.cpp +++ libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.weak.obs/lock.pass.cpp @@ -34,7 +34,7 @@ std::weak_ptr wp; std::shared_ptr sp = wp.lock(); assert(sp.use_count() == 0); - assert(sp.get() == 0); + assert(sp.get() == nullptr); assert(A::count == 0); } { @@ -52,7 +52,7 @@ sp0.reset(); std::shared_ptr sp = wp.lock(); assert(sp.use_count() == 0); - assert(sp.get() == 0); + assert(sp.get() == nullptr); assert(A::count == 0); } assert(A::count == 0); Index: libcxx/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.asgn/move.pass.cpp =================================================================== --- libcxx/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.asgn/move.pass.cpp +++ libcxx/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.asgn/move.pass.cpp @@ -46,7 +46,7 @@ if (!TEST_IS_CONSTANT_EVALUATED) assert(A::count == expect_alive); assert(s2.get() == p); - assert(s1.get() == 0); + assert(s1.get() == nullptr); } if (!TEST_IS_CONSTANT_EVALUATED) assert(A::count == 0); @@ -59,7 +59,7 @@ assert(A::count == (expect_alive * 2)); s2 = std::move(s1); assert(s2.get() == p); - assert(s1.get() == 0); + assert(s1.get() == nullptr); if (!TEST_IS_CONSTANT_EVALUATED) assert(A::count == expect_alive); assert(s2.get_deleter().state() == 5); @@ -75,7 +75,7 @@ std::unique_ptr&> s2(newValue(expect_alive), d2); s2 = std::move(s1); assert(s2.get() == p); - assert(s1.get() == 0); + assert(s1.get() == nullptr); if (!TEST_IS_CONSTANT_EVALUATED) assert(A::count == expect_alive); assert(d1.state() == 5); Index: libcxx/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.asgn/move_convert.runtime.pass.cpp =================================================================== --- libcxx/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.asgn/move_convert.runtime.pass.cpp +++ libcxx/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.asgn/move_convert.runtime.pass.cpp @@ -27,7 +27,7 @@ assert(A::count == 2); aptr = std::move(bptr); assert(aptr.get() == p); - assert(bptr.get() == 0); + assert(bptr.get() == nullptr); assert(A::count == 1); assert(B::count == 1); } Index: libcxx/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.asgn/move_convert.single.pass.cpp =================================================================== --- libcxx/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.asgn/move_convert.single.pass.cpp +++ libcxx/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.asgn/move_convert.single.pass.cpp @@ -29,7 +29,7 @@ assert(A::count == 2); aptr = std::move(bptr); assert(aptr.get() == p); - assert(bptr.get() == 0); + assert(bptr.get() == nullptr); if (!TEST_IS_CONSTANT_EVALUATED) { assert(A::count == 1); assert(B::count == 1); Index: libcxx/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.asgn/null.pass.cpp =================================================================== --- libcxx/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.asgn/null.pass.cpp +++ libcxx/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.asgn/null.pass.cpp @@ -30,7 +30,7 @@ s2 = NULL; if (!TEST_IS_CONSTANT_EVALUATED) assert(A::count == 0); - assert(s2.get() == 0); + assert(s2.get() == nullptr); } if (!TEST_IS_CONSTANT_EVALUATED) assert(A::count == 0); Index: libcxx/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.asgn/nullptr.pass.cpp =================================================================== --- libcxx/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.asgn/nullptr.pass.cpp +++ libcxx/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.asgn/nullptr.pass.cpp @@ -31,7 +31,7 @@ s2 = nullptr; if (!TEST_IS_CONSTANT_EVALUATED) assert(A::count == 0); - assert(s2.get() == 0); + assert(s2.get() == nullptr); } if (!TEST_IS_CONSTANT_EVALUATED) assert(A::count == 0); Index: libcxx/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.ctor/auto_pointer.pass.cpp =================================================================== --- libcxx/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.ctor/auto_pointer.pass.cpp +++ libcxx/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.ctor/auto_pointer.pass.cpp @@ -68,7 +68,7 @@ std::auto_ptr ap(p); std::unique_ptr up(std::move(ap)); assert(up.get() == p); - assert(ap.get() == 0); + assert(ap.get() == nullptr); assert(A::count == 1); assert(B::count == 1); } @@ -80,7 +80,7 @@ std::unique_ptr up; up = std::move(ap); assert(up.get() == p); - assert(ap.get() == 0); + assert(ap.get() == nullptr); assert(A::count == 1); assert(B::count == 1); } Index: libcxx/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.ctor/default.pass.cpp =================================================================== --- libcxx/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.ctor/default.pass.cpp +++ libcxx/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.ctor/default.pass.cpp @@ -73,18 +73,18 @@ #endif { std::unique_ptr p; - assert(p.get() == 0); + assert(p.get() == nullptr); } { std::unique_ptr > p; - assert(p.get() == 0); + assert(p.get() == nullptr); assert(p.get_deleter().state() == 0); p.get_deleter().set_state(5); assert(p.get_deleter().state() == 5); } { std::unique_ptr > p; - assert(p.get() == 0); + assert(p.get() == nullptr); assert(p.get_deleter().state() == 0); } Index: libcxx/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.ctor/move.pass.cpp =================================================================== --- libcxx/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.ctor/move.pass.cpp +++ libcxx/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.ctor/move.pass.cpp @@ -90,7 +90,7 @@ A* p = s.get(); APtr s2 = std::move(s); assert(s2.get() == p); - assert(s.get() == 0); + assert(s.get() == nullptr); if (!TEST_IS_CONSTANT_EVALUATED) assert(A::count == expect_alive); } @@ -106,7 +106,7 @@ A* p = s.get(); APtr s2 = std::move(s); assert(s2.get() == p); - assert(s.get() == 0); + assert(s.get() == nullptr); if (!TEST_IS_CONSTANT_EVALUATED) assert(A::count == expect_alive); assert(s2.get_deleter().state() == 5); @@ -123,7 +123,7 @@ A* p = s.get(); APtr s2 = std::move(s); assert(s2.get() == p); - assert(s.get() == 0); + assert(s.get() == nullptr); if (!TEST_IS_CONSTANT_EVALUATED) assert(A::count == expect_alive); d.set_state(6); Index: libcxx/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.ctor/null.pass.cpp =================================================================== --- libcxx/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.ctor/null.pass.cpp +++ libcxx/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.ctor/null.pass.cpp @@ -7,6 +7,7 @@ //===----------------------------------------------------------------------===// // UNSUPPORTED: c++03 +// ADDITIONAL_COMPILE_FLAGS: -Wno-zero-as-null-pointer-constant // Index: libcxx/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.ctor/nullptr.pass.cpp =================================================================== --- libcxx/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.ctor/nullptr.pass.cpp +++ libcxx/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.ctor/nullptr.pass.cpp @@ -40,16 +40,16 @@ #endif { std::unique_ptr p(nullptr); - assert(p.get() == 0); + assert(p.get() == nullptr); } { std::unique_ptr > p(nullptr); - assert(p.get() == 0); + assert(p.get() == nullptr); assert(p.get_deleter().state() == 0); } { std::unique_ptr > p(nullptr); - assert(p.get() == 0); + assert(p.get() == nullptr); assert(p.get_deleter().state() == 0); } } Index: libcxx/test/std/utilities/utility/pairs/pairs.pair/ctor.const_first_const_second_cxx03.pass.cpp =================================================================== --- libcxx/test/std/utilities/utility/pairs/pairs.pair/ctor.const_first_const_second_cxx03.pass.cpp +++ libcxx/test/std/utilities/utility/pairs/pairs.pair/ctor.const_first_const_second_cxx03.pass.cpp @@ -30,7 +30,7 @@ { { typedef std::pair P; - P p(3.5f, 0); + P p(3.5f, nullptr); assert(p.first == 3.5f); assert(p.second == nullptr); } Index: libcxx/test/support/controlled_allocators.h =================================================================== --- libcxx/test/support/controlled_allocators.h +++ libcxx/test/support/controlled_allocators.h @@ -72,7 +72,7 @@ std::size_t last_size = 0; std::size_t last_align = 0; - void * last_pointer = 0; + void * last_pointer = nullptr; std::size_t last_alloc_size = 0; std::size_t last_alloc_align = 0; Index: libcxx/test/support/nasty_string.h =================================================================== --- libcxx/test/support/nasty_string.h +++ libcxx/test/support/nasty_string.h @@ -113,7 +113,7 @@ return s; ++s; } - return 0; + return nullptr; } constexpr nasty_char* nasty_char_traits::move(nasty_char* s1, const nasty_char* s2, size_t n) { Index: libcxx/utils/libcxx/test/dsl.py =================================================================== --- libcxx/utils/libcxx/test/dsl.py +++ libcxx/utils/libcxx/test/dsl.py @@ -253,7 +253,7 @@ #include int main(int argc, char** argv) { for (int i = 1; i < argc; i++) { - if (::setlocale(LC_ALL, argv[i]) != NULL) { + if (::setlocale(LC_ALL, argv[i]) != nullptr) { return 0; } } Index: libcxx/utils/libcxx/test/params.py =================================================================== --- libcxx/utils/libcxx/test/params.py +++ libcxx/utils/libcxx/test/params.py @@ -18,6 +18,7 @@ '-Wshadow', '-Wundef', '-Wunused-template', + '-Wzero-as-null-pointer-constant', '-Wno-unused-command-line-argument', '-Wno-attributes', '-Wno-pessimizing-move', Index: libunwind/test/forceunwind.pass.cpp =================================================================== --- libunwind/test/forceunwind.pass.cpp +++ libunwind/test/forceunwind.pass.cpp @@ -41,7 +41,7 @@ assert(exceptionObject == &ex); assert(stop_parameter == &foo); - Dl_info info = {0, 0, 0, 0}; + Dl_info info = {nullptr, nullptr, nullptr, nullptr}; // Unwind util the main is reached, above frames depend on the platform and // architecture. Index: libunwind/test/signal_unwind.pass.cpp =================================================================== --- libunwind/test/signal_unwind.pass.cpp +++ libunwind/test/signal_unwind.pass.cpp @@ -26,7 +26,7 @@ _Unwind_Reason_Code frame_handler(struct _Unwind_Context* ctx, void* arg) { (void)arg; - Dl_info info = { 0, 0, 0, 0 }; + Dl_info info = { nullptr, nullptr, nullptr, nullptr }; // Unwind util the main is reached, above frames depend on the platform and // architecture. @@ -39,7 +39,7 @@ void signal_handler(int signum) { (void)signum; - _Unwind_Backtrace(frame_handler, NULL); + _Unwind_Backtrace(frame_handler, nullptr); _Exit(-1); } Index: libunwind/test/unwind_leaffunction.pass.cpp =================================================================== --- libunwind/test/unwind_leaffunction.pass.cpp +++ libunwind/test/unwind_leaffunction.pass.cpp @@ -26,7 +26,7 @@ _Unwind_Reason_Code frame_handler(struct _Unwind_Context* ctx, void* arg) { (void)arg; - Dl_info info = { 0, 0, 0, 0 }; + Dl_info info = { nullptr, nullptr, nullptr, nullptr }; // Unwind until the main is reached, above frames deeped on the platform and // architecture. @@ -39,7 +39,7 @@ void signal_handler(int signum) { (void)signum; - _Unwind_Backtrace(frame_handler, NULL); + _Unwind_Backtrace(frame_handler, nullptr); _Exit(-1); }