mirror of
https://github.com/scylladb/scylladb.git
synced 2026-06-04 05:53:13 +00:00
cql parser: fix conversion from uninitalized<T> to optional<T> with gcc 9
We use uninitialized<T> (wrapping an optional<T>) to adjust to the parser's way of laying out the code, but this fails with gcc 9 (presumably for the correct reasons) when converting from uninitialized<T> back to optional<T>. Add a conversion operator to make it build.
This commit is contained in:
@@ -125,6 +125,7 @@ struct uninitialized {
|
||||
uninitialized& operator=(uninitialized&&) = default;
|
||||
operator const T&() const & { return check(), *_val; }
|
||||
operator T&&() && { return check(), std::move(*_val); }
|
||||
operator std::optional<T>&&() && { return check(), std::move(_val); }
|
||||
void check() const { if (!_val) { throw std::runtime_error("not intitialized"); } }
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user