Created on 2024-03-01.00:00:00 last changed 1 month ago
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-03-01 00:00:00 | admin | create |