[Bug libstdc++/78723] New: [variant] P0393r3: "Making variant greater equal again" is unimplemented
eric at efcs dot ca
gcc-bugzilla@gcc.gnu.org
Wed Dec 7 21:32:00 GMT 2016
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78723
Bug ID: 78723
Summary: [variant] P0393r3: "Making variant greater equal
again" is unimplemented
Product: gcc
Version: 7.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libstdc++
Assignee: unassigned at gcc dot gnu.org
Reporter: eric at efcs dot ca
Target Milestone: ---
Link to paper:
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0393r3.html
Reproducer:
// g++ -std=c++1z test.cpp
#include <variant>
#include <type_traits>
#include <cassert>
struct MakeEmptyT {
MakeEmptyT() = default;
MakeEmptyT(MakeEmptyT &&) { throw 42; }
MakeEmptyT &operator=(MakeEmptyT &&) { throw 42; }
};
inline bool operator<(const MakeEmptyT &, const MakeEmptyT &) {
assert(false);
return false;
}
template <class Variant> void makeEmpty(Variant &v) {
Variant v2(std::in_place_type<MakeEmptyT>);
try {
v = std::move(v2);
assert(false);
} catch (...) {
assert(v.valueless_by_exception());
}
}
int main() {
using V = std::variant<int, MakeEmptyT>;
V v1;
V v2;
makeEmpty(v2);
assert((v1 < v2) == false);
}
More information about the Gcc-bugs
mailing list