Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

recursive_wrapper fail to compile when used with 2 classes which are base and derived #146

Closed
BlueSolei opened this issue Apr 25, 2017 · 1 comment

Comments

@BlueSolei
Copy link
Contributor

BlueSolei commented Apr 25, 2017

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

@artemp
Copy link
Contributor

artemp commented May 1, 2017

Fixed in #147, closing.

@artemp artemp closed this as completed May 1, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants