diff --git a/libcxx/docs/Cxx2aStatusPaperStatus.csv b/libcxx/docs/Cxx2aStatusPaperStatus.csv --- a/libcxx/docs/Cxx2aStatusPaperStatus.csv +++ b/libcxx/docs/Cxx2aStatusPaperStatus.csv @@ -43,7 +43,7 @@ "`P0879R0 `__","LWG","Constexpr for swap and swap related functions Also resolves LWG issue 2800.","Rapperswil","","" "`P0887R1 `__","LWG","The identity metafunction","Rapperswil","|Complete|","8.0" "`P0892R2 `__","CWG","explicit(bool)","Rapperswil","","" -"`P0898R3 `__","LWG","Standard Library Concepts","Rapperswil","","" +"`P0898R3 `__","LWG","Standard Library Concepts","Rapperswil","|In Progress|","" "`P0935R0 `__","LWG","Eradicating unnecessarily explicit default constructors from the standard library","Rapperswil","|Complete|","12.0" "`P0941R2 `__","CWG","Integrating feature-test macros into the C++ WD","Rapperswil","|In Progress|","" "`P1023R0 `__","LWG","constexpr comparison operators for std::array","Rapperswil","|Complete|","8.0" @@ -131,7 +131,7 @@ "`P1651 `__","LWG","bind_front should not unwrap reference_wrapper","Cologne","","" "`P1652 `__","LWG","Printf corner cases in std::format","Cologne","","" "`P1661 `__","LWG","Remove dedicated precalculated hash lookup interface","Cologne","|Nothing To Do|","" -"`P1754 `__","LWG","Rename concepts to standard_case for C++20, while we still can","Cologne","","" +"`P1754 `__","LWG","Rename concepts to standard_case for C++20, while we still can","Cologne","|In Progress|","" "","","","","","" "`P0883 `__","LWG","Fixing Atomic Initialization","Belfast","* *","" "`P1391 `__","LWG","Range constructor for std::string_view","Belfast","* *","" diff --git a/libcxx/include/concepts b/libcxx/include/concepts --- a/libcxx/include/concepts +++ b/libcxx/include/concepts @@ -157,6 +157,11 @@ template concept same_as = __same_as_impl<_Tp, _Up> && __same_as_impl<_Up, _Tp>; +// [concept.destructible] + +template +concept destructible = _VSTD::is_nothrow_destructible_v<_Tp>; + #endif //_LIBCPP_STD_VER > 17 && defined(__cpp_concepts) && __cpp_concepts >= 201811L _LIBCPP_END_NAMESPACE_STD diff --git a/libcxx/test/std/concepts/concept.destructible/destructible.compile.pass.cpp b/libcxx/test/std/concepts/concept.destructible/destructible.compile.pass.cpp new file mode 100644 --- /dev/null +++ b/libcxx/test/std/concepts/concept.destructible/destructible.compile.pass.cpp @@ -0,0 +1,87 @@ +//===----------------------------------------------------------------------===// +// +// 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, c++11, c++14, c++17 +// UNSUPPORTED: libcpp-no-concepts + +// template +// concept destructible = is_nothrow_destructible_v; + +#include +#include + +struct Empty {}; + +struct Defaulted { + ~Defaulted() = default; +}; +struct Deleted { + ~Deleted() = delete; +}; + +struct Noexcept { + ~Noexcept() noexcept; +}; +struct NoexceptTrue { + ~NoexceptTrue() noexcept(true); +}; +struct NoexceptFalse { + ~NoexceptFalse() noexcept(false); +}; + +// Since C++17 dynamic exception specifications are no longer +// part of the standard. +struct Throw { + ~Throw() throw(); +}; + +struct Protected { +protected: + ~Protected() = default; +}; +struct Private { +private: + ~Private() = default; +}; + +template +struct NoexceptDependant { + ~NoexceptDependant() noexcept(std::is_same_v); +}; + +template +void test() { + static_assert(std::destructible == std::is_nothrow_destructible_v); +} + +void test() { + test(); + + test(); + test(); + + test(); + test(); + test(); + + test(); + + test(); + test(); + + test >(); + test >(); + + test(); + test(); + test(); + test(); +} + +// Required for MSVC internal test runner compatibility. +int main(int, char**) { return 0; }