File tree 1 file changed +29
-2
lines changed
1 file changed +29
-2
lines changed Original file line number Diff line number Diff line change 1
-
2
1
#include " catch.hpp"
3
2
3
+ #include < mapbox/variant.hpp>
4
4
#include < mapbox/recursive_wrapper.hpp>
5
5
6
6
#include < type_traits>
@@ -153,6 +153,33 @@ TEST_CASE("recursive wrapper of pair<int, int>")
153
153
b = std::move (c);
154
154
REQUIRE (b.get ().first == 5 );
155
155
REQUIRE (b.get ().second == 6 );
156
- // REQUIRE(c.get_pointer() == nullptr);
156
+ // REQUIRE(c.get_pointer() == nullptr);
157
+ }
158
+
159
+ SECTION (" Multiple recurssive wrappers of polymorphic types" )
160
+ {
161
+ // https://github.com/mapbox/variant/issues/146
162
+ // (Visual Studio 2015 update 3)
163
+ using namespace mapbox ::util;
164
+ struct Base ;
165
+ struct Derived ;
166
+ using Variant = variant<recursive_wrapper<Base>, recursive_wrapper<Derived>>;
167
+ struct Base { };
168
+ struct Derived : public Base { };
169
+ {
170
+ Base base;
171
+ Derived derived;
172
+ Variant v;
173
+ v = base;
174
+ v = derived; // compile error prior https://github.com/mapbox/variant/pull/147
175
+ CHECK (v.is <Derived>());
176
+ }
177
+ {
178
+ Derived derived;
179
+ Variant v (derived); // compile error prior https://github.com/mapbox/variant/pull/147
180
+ CHECK (v.is <Derived>());
181
+ }
182
+
183
+
157
184
}
158
185
}
You can’t perform that action at this time.
0 commit comments