Index: libcxx/include/concepts =================================================================== --- libcxx/include/concepts +++ 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 Index: libcxx/test/std/concepts/concept.destructible/destructible.pass.cpp =================================================================== --- /dev/null +++ libcxx/test/std/concepts/concept.destructible/destructible.pass.cpp @@ -0,0 +1,63 @@ +//===----------------------------------------------------------------------===// +// +// 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 +#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); +}; + +void test() { + static_assert( std::destructible); + + static_assert( std::destructible); + static_assert(!std::destructible); + + static_assert( std::destructible); + static_assert( std::destructible); + static_assert(!std::destructible); + + static_assert( std::destructible); + + static_assert(!std::destructible); + static_assert(!std::destructible); + + static_assert( std::destructible>); + static_assert(!std::destructible>); +} + +int main(int, char**) { + test(); + + return 0; +} Index: libcxx/www/cxx2a_status.html =================================================================== --- libcxx/www/cxx2a_status.html +++ libcxx/www/cxx2a_status.html @@ -99,7 +99,7 @@ P0879R0LWGConstexpr for swap and swap related functions Also resolves LWG issue 2800.Rapperswil P0887R1LWGThe identity metafunctionRapperswilComplete8.0 P0892R2CWGexplicit(bool)Rapperswil - P0898R3LWGStandard Library ConceptsRapperswil + P0898R3LWGStandard Library ConceptsRapperswilIn progress P0935R0LWGEradicating unnecessarily explicit default constructors from the standard libraryRapperswil P0941R2CWGIntegrating feature-test macros into the C++ WDRapperswilIn progress P1023R0LWGconstexpr comparison operators for std::arrayRapperswilComplete8.0 @@ -190,7 +190,7 @@ P1651LWGbind_front should not unwrap reference_wrapperCologne P1652LWGPrintf corner cases in std::formatCologne P1661LWGRemove dedicated precalculated hash lookup interfaceCologneNothing to do - P1754LWGRename concepts to standard_case for C++20, while we still canCologne + P1754LWGRename concepts to standard_case for C++20, while we still canCologneIn progress P0883LWGFixing Atomic Initialization Belfast