diff --git a/libcxx/docs/ReleaseNotes.rst b/libcxx/docs/ReleaseNotes.rst --- a/libcxx/docs/ReleaseNotes.rst +++ b/libcxx/docs/ReleaseNotes.rst @@ -42,6 +42,7 @@ - P2445R1 - ``std::forward_like`` - P2273R3 - Making ``std::unique_ptr`` constexpr - P0591R4 - Utility functions to implement uses-allocator construction +- P1169R4 - ``static operator()`` Improvements and New Features ----------------------------- diff --git a/libcxx/docs/Status/Cxx2bPapers.csv b/libcxx/docs/Status/Cxx2bPapers.csv --- a/libcxx/docs/Status/Cxx2bPapers.csv +++ b/libcxx/docs/Status/Cxx2bPapers.csv @@ -53,7 +53,7 @@ "","","","","","" "`P0009R18 `__","LWG","mdspan: A Non-Owning Multidimensional Array Reference","July 2022","","" "`P0429R9 `__","LWG","A Standard ``flat_map``","July 2022","","" -"`P1169R4 `__","LWG","``static operator()``","July 2022","","" +"`P1169R4 `__","LWG","``static operator()``","July 2022","|Complete|","16.0" "`P1222R4 `__","LWG","A Standard ``flat_set``","July 2022","","" "`P1223R5 `__","LWG","``ranges::find_last()``, ``ranges::find_last_if()``, and ``ranges::find_last_if_not()``","July 2022","","" "`P1467R9 `__","LWG","Extended ``floating-point`` types and standard names","July 2022","","" diff --git a/libcxx/include/__functional/function.h b/libcxx/include/__functional/function.h --- a/libcxx/include/__functional/function.h +++ b/libcxx/include/__functional/function.h @@ -1069,6 +1069,20 @@ template struct __strip_signature; +# if defined(__cpp_static_call_operator) && __cpp_static_call_operator >= 202207L + +template +struct __strip_signature<_Rp(*)(_Args...)> { + using type = _Rp(_Args...); +}; + +template +struct __strip_signature<_Rp(*)(_Args...) noexcept> { + using type = _Rp(_Args...); +}; + +# endif // defined(__cpp_static_call_operator) && __cpp_static_call_operator >= 202207L + template struct __strip_signature<_Rp (_Gp::*) (_Ap...)> { using type = _Rp(_Ap...); }; template diff --git a/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/ctad.static.compile.pass.cpp b/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/ctad.static.compile.pass.cpp new file mode 100644 --- /dev/null +++ b/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/ctad.static.compile.pass.cpp @@ -0,0 +1,30 @@ +//===----------------------------------------------------------------------===// +// +// 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 +// UNSUPPORTED: (c++17 || c++20) && !stdlib=libc++ +// ADDITIONAL_COMPILE_FLAGS: -Wno-c++2b-extensions + +// checks that CTAD for std::function works properly with static operator() overloads + +#include +#include + +#if defined(__cpp_static_call_operator) && __cpp_static_call_operator >= 202207L + +struct Except { + static int operator()(int*, long*) { return 0; } +}; +static_assert(std::is_same_v>); + +struct Noexcept { + static int operator()(int*, long*) noexcept { return 0; } +}; +static_assert(std::is_same_v>); + +#endif