[Bug libstdc++/105153] New: wrong constraint in std::expected<void>'s constructor
hewillk at gmail dot com
gcc-bugzilla@gcc.gnu.org
Mon Apr 4 19:27:17 GMT 2022
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105153
Bug ID: 105153
Summary: wrong constraint in std::expected<void>'s constructor
Product: gcc
Version: 12.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libstdc++
Assignee: unassigned at gcc dot gnu.org
Reporter: hewillk at gmail dot com
Target Milestone: ---
std/expected#L970:
template<typename _Up, typename _Gr>
requires is_void_v<_Tp>
&& is_constructible_v<_Er, const _Gr&>
&& (!__cons_from_expected<_Up, _Gr>)
constexpr explicit(!is_convertible_v<_Gr, _Er>)
expected(expected<_Up, _Gr>&& __x)
noexcept(is_nothrow_constructible_v<_Er, _Gr>)
: _M_void(), _M_has_value(__x._M_has_value)
{
if (!_M_has_value)
std::construct_at(__builtin_addressof(_M_unex),
std::move(__x)._M_unex);
}
Should be is_constructible_v<_Er, _Gr>.
#include <expected>
struct E {
E(int&&) = delete;
E(const int&);
};
int main() {
std::expected<void, E> e(std::expected<void, int>{});
}
https://godbolt.org/z/KGa4b7aYa
More information about the Gcc-bugs
mailing list