libstdc++: don't implicit-construct _Yielded_decvref [PR118022]
This overload requires constructible_from<remove_cvref_t<yielded>, const remove_reference_t<yielded>&> ... but then tries to construct remove_cvref_t<yielded> implicitly, which means it imposes an additional constraint not in the standard. libstdc++-v3/ChangeLog: PR libstdc++/118022 * include/std/generator (_Promise_erased::yield_value(const _Yielded_deref&)): Don't implicit-constuct _Yielded_decvref. * testsuite/24_iterators/range_generators/pr118022.cc: New test.
This commit is contained in:
parent
4731ead79f
commit
5a41ab8da0
2 changed files with 17 additions and 1 deletions
|
@ -144,7 +144,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
|
|||
requires (is_rvalue_reference_v<_Yielded>
|
||||
&& constructible_from<_Yielded_decvref,
|
||||
const _Yielded_deref&>)
|
||||
{ return _Copy_awaiter(__val, _M_bottom_value()); }
|
||||
{ return _Copy_awaiter(_Yielded_decvref(__val), _M_bottom_value()); }
|
||||
|
||||
template<typename _R2, typename _V2, typename _A2, typename _U2>
|
||||
requires std::same_as<_Yield2_t<_R2, _V2>, _Yielded>
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
// { dg-do compile { target c++23 } }
|
||||
#include <generator>
|
||||
|
||||
struct O {
|
||||
O() = default;
|
||||
explicit O(const O&) = default;
|
||||
};
|
||||
|
||||
std::generator<O&&> gen() {
|
||||
const O o;
|
||||
co_yield o;
|
||||
}
|
||||
|
||||
int
|
||||
main()
|
||||
{}
|
Loading…
Add table
Reference in a new issue