https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87431
--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> --- Can we do any better than this? --- a/libstdc++-v3/include/std/variant +++ b/libstdc++-v3/include/std/variant @@ -439,6 +439,8 @@ namespace __variant constexpr bool _M_valid() const noexcept { + if constexpr ((is_scalar_v<_Types> && ...)) + return true; return this->_M_index != __index_type(variant_npos); } Any non-scalar type can have a constructor that throws, which could be called via variant::emplace.