From c26ec176dd438c45ae1964b67bf0da3ebfaf1b16 Mon Sep 17 00:00:00 2001 From: Avi Kivity Date: Tue, 7 May 2019 09:21:22 +0300 Subject: [PATCH] cql parser: fix conversion from uninitalized to optional with gcc 9 We use uninitialized (wrapping an optional) 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 back to optional. Add a conversion operator to make it build. --- cql3/Cql.g | 1 + 1 file changed, 1 insertion(+) diff --git a/cql3/Cql.g b/cql3/Cql.g index 3c76ec1493..853d68d3d0 100644 --- a/cql3/Cql.g +++ b/cql3/Cql.g @@ -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&&() && { return check(), std::move(_val); } void check() const { if (!_val) { throw std::runtime_error("not intitialized"); } } };