diff --git a/libcxx/include/__memory/unique_ptr.h b/libcxx/include/__memory/unique_ptr.h index f75259473efb12..7f5e0ea243c956 100644 --- a/libcxx/include/__memory/unique_ptr.h +++ b/libcxx/include/__memory/unique_ptr.h @@ -36,7 +36,6 @@ #include <__type_traits/is_trivially_relocatable.h> #include <__type_traits/is_void.h> #include <__type_traits/remove_extent.h> -#include <__type_traits/remove_pointer.h> #include <__type_traits/type_identity.h> #include <__utility/declval.h> #include <__utility/forward.h> @@ -52,17 +51,6 @@ _LIBCPP_PUSH_MACROS _LIBCPP_BEGIN_NAMESPACE_STD -#ifndef _LIBCPP_CXX03_LANG - -template -struct __is_noexcept_deref_or_void { - static constexpr bool value = noexcept(*std::declval<_Ptr>()); -}; - -template <> -struct __is_noexcept_deref_or_void : true_type {}; -#endif - template struct _LIBCPP_TEMPLATE_VIS default_delete { static_assert(!is_function<_Tp>::value, "default_delete cannot be instantiated for function types"); @@ -266,7 +254,7 @@ class _LIBCPP_UNIQUE_PTR_TRIVIAL_ABI _LIBCPP_TEMPLATE_VIS unique_ptr { } _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 __add_lvalue_reference_t<_Tp> operator*() const - _NOEXCEPT_(__is_noexcept_deref_or_void::value) { + _NOEXCEPT_(_NOEXCEPT_(*std::declval())) { return *__ptr_.first(); } _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 pointer operator->() const _NOEXCEPT { return __ptr_.first(); } diff --git a/libcxx/test/std/utilities/memory/unique.ptr/iterator_concept_conformance.compile.pass.cpp b/libcxx/test/std/utilities/memory/unique.ptr/iterator_concept_conformance.compile.pass.cpp index 55b7b50418ce73..327208edfeea6f 100644 --- a/libcxx/test/std/utilities/memory/unique.ptr/iterator_concept_conformance.compile.pass.cpp +++ b/libcxx/test/std/utilities/memory/unique.ptr/iterator_concept_conformance.compile.pass.cpp @@ -22,11 +22,3 @@ static_assert(std::indirectly_movable_storable, std::unique static_assert(std::indirectly_copyable, std::unique_ptr>); static_assert(std::indirectly_copyable_storable, std::unique_ptr>); static_assert(std::indirectly_swappable, std::unique_ptr >); - -static_assert(!std::indirectly_readable >); -static_assert(!std::indirectly_writable, void>); -static_assert(!std::weakly_incrementable >); -static_assert(!std::indirectly_movable, std::unique_ptr>); -static_assert(!std::indirectly_movable_storable, std::unique_ptr>); -static_assert(!std::indirectly_copyable, std::unique_ptr>); -static_assert(!std::indirectly_copyable_storable, std::unique_ptr>); diff --git a/libcxx/test/std/utilities/memory/unique.ptr/noexcept_operator_star.compile.pass.cpp b/libcxx/test/std/utilities/memory/unique.ptr/noexcept_operator_star.compile.pass.cpp deleted file mode 100644 index a2d788005f0cd7..00000000000000 --- a/libcxx/test/std/utilities/memory/unique.ptr/noexcept_operator_star.compile.pass.cpp +++ /dev/null @@ -1,25 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03 - -// unique_ptr - -// add_lvalue_reference_t operator*() const noexcept(noexcept(*declval())); - -// Dereferencing pointer directly in noexcept fails for a void pointer. This -// is not SFINAE-ed away leading to a hard error. The issue was originally -// triggered by -// test/std/utilities/memory/unique.ptr/iterator_concept_conformance.compile.pass.cpp -// -// This test validates whether the code compiles. - -#include - -extern const std::unique_ptr p; -void f() { [[maybe_unused]] bool b = noexcept(p.operator*()); } diff --git a/libcxx/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.observers/dereference.single.pass.cpp b/libcxx/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.observers/dereference.single.pass.cpp index 17902a4ce27a4a..ba7f8bbb76222a 100644 --- a/libcxx/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.observers/dereference.single.pass.cpp +++ b/libcxx/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.observers/dereference.single.pass.cpp @@ -31,10 +31,6 @@ struct Deleter { #endif TEST_CONSTEXPR_CXX23 bool test() { - ASSERT_NOEXCEPT(*(std::unique_ptr{})); -#if TEST_STD_VER >= 11 - static_assert(noexcept(*std::declval>()), ""); -#endif { std::unique_ptr p(new int(3)); assert(*p == 3);