diff --git a/libcxx/docs/Status/Cxx2bIssues.csv b/libcxx/docs/Status/Cxx2bIssues.csv --- a/libcxx/docs/Status/Cxx2bIssues.csv +++ b/libcxx/docs/Status/Cxx2bIssues.csv @@ -212,7 +212,7 @@ "`3751 `__","Missing feature macro for ``flat_set``", "November 2022","","","|flat_containers|" "`3753 `__","Clarify entity vs. freestanding entity", "November 2022","","","" "`3754 `__","Class template expected synopsis contains declarations that do not match the detailed description", "November 2022","|Nothing to do|","","" -"`3755 `__","``tuple-for-each`` can call ``user-defined`` ``operator,``", "November 2022","","","" +"`3755 `__","``tuple-for-each`` can call ``user-defined`` ``operator,``", "November 2022","|Complete|","17.0","" "`3757 `__","What's the effect of ``std::forward_like(x)``?", "November 2022","","","" "`3759 `__","``ranges::rotate_copy`` should use ``std::move``", "November 2022","","","|ranges|" "`3760 `__","``cartesian_product_view::iterator``'s ``parent_`` is never valid", "November 2022","","","|ranges|" diff --git a/libcxx/include/__ranges/zip_view.h b/libcxx/include/__ranges/zip_view.h --- a/libcxx/include/__ranges/zip_view.h +++ b/libcxx/include/__ranges/zip_view.h @@ -77,7 +77,9 @@ template _LIBCPP_HIDE_FROM_ABI constexpr void __tuple_for_each(_Fun&& __f, _Tuple&& __tuple) { std::apply( - [&](_Types&&... __elements) { (std::invoke(__f, std::forward<_Types>(__elements)), ...); }, + [&](_Types&&... __elements) { + (static_cast(std::invoke(__f, std::forward<_Types>(__elements))), ...); + }, std::forward<_Tuple>(__tuple)); } diff --git a/libcxx/test/libcxx/ranges/range.adaptors/range.adaptor.tuple/tuple-for-each.pass.cpp b/libcxx/test/libcxx/ranges/range.adaptors/range.adaptor.tuple/tuple-for-each.pass.cpp new file mode 100644 --- /dev/null +++ b/libcxx/test/libcxx/ranges/range.adaptors/range.adaptor.tuple/tuple-for-each.pass.cpp @@ -0,0 +1,31 @@ +//===----------------------------------------------------------------------===// +// +// 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, c++20 + +// + +// template +// constexpr void tuple-for-each(F&& f, Tuple&& t) { // exposition only + +// LWG3755 tuple-for-each can call user-defined operator, + +#include +#include +#include + +struct Evil { + void operator,(Evil) { std::abort(); } +}; + +int main(int, char**) { + std::tuple t; + std::ranges::__tuple_for_each([](int) { return Evil{}; }, t); + + return 0; +}