[Bug libstdc++/90943] Visiting inherited variants no longer works in 9.1
barry.revzin at gmail dot com
gcc-bugzilla@gcc.gnu.org
Thu Jun 20 02:20:00 GMT 2019
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90943
--- Comment #2 from Barry Revzin <barry.revzin at gmail dot com> ---
What if we did something like (using pretty names for a sec):
template <typename _Maybe_variant_cookie, typename _Variant>
struct _Extra_visit_slot_needed
{
template <typename... _Types>
static bool_constant<__never_valueless<_Types...>()>
__impl(const variant<_Types...>&);
static false_type __impl(...);
using _Variant_never_valueless = decltype(__impl(declval<_Variant>()));
static constexpr bool value =
(is_same_v<_Maybe_variant_cookie, __variant_cookie>
|| is_same_v<_Maybe_variant_cookie, __variant_idx_cookie>)
&& !_Variant_never_valueless::value;
};
This should (modulo typos) work for real variant instantiations and also
anything that inherits from some variant instantiation?
More information about the Gcc-bugs
mailing list