7 Apr
2019
7 Apr
'19
3:33 a.m.
Andrzej Krzemienski wrote:
Consider the following example:
``` struct X {};
struct Guard { explicit Guard(int) {} Guard(Guard&&) = delete; };
variant
v {}; v.emplace<Guard>(1); ``` This works fine with std::variant, but fails to compile with variant2::variant, because the latter requires all the alternative types, at least in one implementaiton of the never-empty trick, to be move-constructible. But this requirement is never listed in either global requirements for alternative types stored in variant, or in the specification of functions `emplace()`.
The documentation is correct, the implementation is wrong here; this should work and the fact that it doesn't is a bug. Thanks.