Created on 2024-03-01.00:00:00 last changed 3 months ago
Proposed resolution:
This wording is relative to N4988.
Modify [coro.generator.iterator] as indicated:
namespace std { template<class Ref, class Val, class Allocator> class generator<Ref, Val, Allocator>::iterator { […] reference operator*() const[…]noexcept(is_nothrow_copy_constructible_v<reference>); […] }; }-3- Returns: *this.
reference operator*() constnoexcept(is_nothrow_copy_constructible_v<reference>l);-4- Preconditions: For some generator object x, coroutine_ is in *x.active_ and x.active_->top() refers to a suspended coroutine with promise object p.
[ 2024-09-16; Casey provides wording ]
In the prioritization thread, LWG discussed a couple of alternatives without much enthusiasm. One of the alternatives was to simply remove the noexcept-specifier, which seems to be the most efficient use of LWG's time.
[ 2024-06-24; Reflector poll ]
Set priority to 3 after reflector poll.
"Just remove the noexcept-specifier."
"Maybe add is_reference_v<reference> || ...
"
generator::iterator's operator* is specified to have the following noexcept-specifier:
noexcept(is_nothrow_copy_constructible_v<reference>)
When reference is an rvalue reference type, is_nothrow_copy_constructible_v<reference> is false (because reference is not copy constructible), which means operator* is not noexcept.
However, operator* doesn't perform any potentially-throwing operation in this case. It's effect is equivalent to return static_cast<reference>(*p.value_); (where the type of p.value_ is effectively add_pointer_t<reference>). Neither the dereference nor the cast to rvalue reference can throw an exception. I think the expression inside the noexcept-specifier should be changed to noexcept(static_cast<reference>(*p.value_)).History | |||
---|---|---|---|
Date | User | Action | Args |
2024-09-17 14:17:51 | admin | set | messages: + msg14367 |
2024-09-17 14:17:51 | admin | set | messages: + msg14366 |
2024-06-24 12:43:36 | admin | set | messages: + msg14194 |
2024-03-01 00:00:00 | admin | create |