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,66 @@ +//===----------------------------------------------------------------------===// +// +// 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>(); +} + +// Required for MSVC internal test runner compatibility. +int main(int, char**) { + return 0; +} diff --git a/libcxx/www/cxx2a_status.html b/libcxx/www/cxx2a_status.html --- a/libcxx/www/cxx2a_status.html +++ b/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