Unexpected behavior when initializing with const references
jfirebaugh opened this issue · 1 comments
jfirebaugh commented
Consider the following:
using value = mapbox::util::variant<bool, uint64_t>;
uint64_t u(1234);
assert(value(u).is<uint64_t>()); // passes
uint64_t& ur(u);
assert(value(ur).is<uint64_t>()); // passes
uint64_t const& ucr(u);
assert(value(ucr).is<uint64_t>()); // fails, it's bool!
The last assertion should not fail.
artemp commented
@jfirebaugh - fixed and test added (b3a002d + c511b2f)
In value_traits
both reference and const specifier needs stripping to correctly calculate direct_type
matching.
/cc @springmeyer @joto