I am confused why the following didn't compile on clang++6.0 but works perfectly on G++7.x, both with -std=c++17
.
std::variant<int, float> a;
a = 1;
This gives me the error on clang++6.0 for the following:
error: cannot cast 'std::variant<int, double>' to its private base class
'std::__detail::__variant::_Variant_storage<true, int, double>'
return __get(std::in_place_index<_Np>, std::forward<_Variant>(__v)._M_u);
...
Is there anything wrong with the value assignment?