The following code fails to compile (Visual Studio 2015 update 3):
#include <mapbox/variant.hpp>
using namespace mapbox::util;
struct Base;
struct Derived;
using Variant = variant<recursive_wrapper<Base>, recursive_wrapper<Derived>>;
struct Base { };
struct Derived : public Base { };
void TestMultipleRecursiveWrappers()
{
Base base;
Derived derived;
Variant v;
v = base;
v = derived; // error
}
void OrEvenShorterExample()
{
Derived derived;
Variant v(derived); // error
}
error C2664: 'mapbox::util::variant<mapbox::util::recursive_wrapper,mapbox::util::recursive_wrapper>::variant(mapbox::util::variant<mapbox::util::recursive_wrapper,mapbox::util::recursive_wrapper> &&) noexcept()': cannot convert argument 1 from 'Derived' to 'mapbox::util::no_init'
note: No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
The following code fails to compile (Visual Studio 2015 update 3):
error C2664: 'mapbox::util::variant<mapbox::util::recursive_wrapper ,mapbox::util::recursive_wrapper>::variant(mapbox::util::variant<mapbox::util::recursive_wrapper ,mapbox::util::recursive_wrapper> &&) noexcept()': cannot convert argument 1 from 'Derived' to 'mapbox::util::no_init'
note: No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called