mapbox / variant

C++11/C++14 Variant
BSD 3-Clause "New" or "Revised" License
371 stars 101 forks source link

Issues with moving nested variants #117

Closed artemp closed 7 years ago

artemp commented 8 years ago

https://gist.github.com/kkaefer/6a9a14cda8fffe36e206ec543dbc5d48

artemp commented 7 years ago

The test case above compiles with latest v1.1.4 and also following snippet compiles and runs using clang++ on OSX

#include <mapbox/variant.hpp>
#include <iostream>

using foo = mapbox::util::variant<int, float>;
using bar = mapbox::util::variant<foo, unsigned>;

int main()
{
    bar value = foo(3.2f);
    std::cerr << mapbox::util::get<float>(mapbox::util::get<foo>(value)) << std::endl;
    return 0;
}
clang++ -std=c++14 -I/Users/artem/Projects/mapbox/variant/include  nested-variant.cpp -o test 
./test 
3.2

Closing, feel free to reopen if it's still fails on some platform/compiler combos

/cc @kkaefer @springmeyer @joto