Closed frankheckenbach closed 6 years ago
Traced it down a bit, seems to be a consequence of this GCC bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80654 So probably nothing this code can do about it. (Well, not easily; apparently GCC's std::variant doesn't hit the bug, but its implementation is probably too different.)
Apparently a vector of a move-only type doesn't seem to work as an element type of this variant implementation. I don't quite understand why, as unique_ptr by itself does work, and as I understand it a vector of this type should be moveable (and not copyable) just like unique_ptr itself.
E.g., using gcc 7.3.0 with "--std=c++17" (also with gcc 6.3.0), the following code does not compile:
Whereas the same code with std::variant does compile (gcc 7.3.0 only; 6.3.0 doesn't yet have std::variant):
Any ideas? (Or workarounds?)