This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/78723] New: [variant] P0393r3: "Making variant greater equal again" is unimplemented
- From: "eric at efcs dot ca" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 07 Dec 2016 21:32:14 +0000
- Subject: [Bug libstdc++/78723] New: [variant] P0393r3: "Making variant greater equal again" is unimplemented
- Auto-submitted: auto-generated
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);
}