@@ -452,22 +452,15 @@ IRIS_RVARIANT_ALWAYS_THROWING_UNREACHABLE_BEGIN
452452 this ->template reset_construct_never_valueless <I>(std::forward<Args>(args)...);
453453
454454 } else {
455- this ->raw_visit ([&, this ]<std::size_t old_i, class T_old_i >(std::in_place_index_t <old_i>, T_old_i& t_old_i)
456- noexcept (std::is_nothrow_constructible_v<T, Args...>)
457- {
455+ this ->raw_visit ([&, this ]<std::size_t old_i, class T_old_i >(std::in_place_index_t <old_i>, T_old_i& t_old_i) {
458456 static_assert (!std::is_reference_v<T_old_i>);
459457 static_assert (!std::is_const_v<T_old_i>);
460458
461459 if constexpr (old_i == std::variant_npos) {
462460 (void )t_old_i;
463461 this ->template construct_on_valueless <I>(std::forward<Args>(args)...);
464462
465- } else if constexpr (std::is_nothrow_constructible_v<T, Args...>) {
466- t_old_i.~T_old_i ();
467- static_assert (std::is_nothrow_constructible_v<storage_type, std::in_place_index_t <old_i>, Args...>);
468- std::construct_at (&this ->storage_ , std::in_place_index<old_i>, std::forward<Args>(args)...);
469-
470- } else if constexpr (std::is_same_v<T_old_i, T>) { // NOT type-changing
463+ } else if constexpr (old_i == I) { // same alternative
471464 if constexpr (
472465 (sizeof (T) <= detail::never_valueless_trivial_size_limit && std::is_trivially_move_assignable_v<T>) ||
473466 is_recursive_wrapper_v<T>
@@ -497,12 +490,12 @@ IRIS_RVARIANT_ALWAYS_THROWING_UNREACHABLE_BEGIN
497490 static_assert (!never_valueless);
498491 t_old_i.~T_old_i ();
499492 this ->index_ = detail::variant_npos<sizeof ...(Ts)>;
500- static_assert (!noexcept (std::construct_at (&this ->storage (), std::in_place_index<old_i >, std::forward<Args>(args)...)));
501- std::construct_at (&this ->storage_ , std::in_place_index<old_i >, std::forward<Args>(args)...); // may throw
502- this ->index_ = old_i ;
493+ static_assert (!noexcept (std::construct_at (&this ->storage (), std::in_place_index<I >, std::forward<Args>(args)...)));
494+ std::construct_at (&this ->storage_ , std::in_place_index<I >, std::forward<Args>(args)...); // may throw
495+ this ->index_ = I ;
503496 }
504497
505- } else { // type-changing
498+ } else { // another alternative, possibly of the same type
506499 if constexpr (
507500 (sizeof (T) <= detail::never_valueless_trivial_size_limit && std::is_trivially_move_constructible_v<T>) ||
508501 is_recursive_wrapper_v<T>
0 commit comments