From eef68291aa1c8060d0e80b7e34995c2de19c4aa4 Mon Sep 17 00:00:00 2001 From: peter klausler Date: Tue, 8 May 2018 10:32:58 -0700 Subject: [PATCH] [flang] Build with g++ 8.1.0 compiler and headers. Original-commit: flang-compiler/f18@53d80fc8548e04cb80b6acdd7cde1a12641657c0 Reviewed-on: https://github.com/flang-compiler/f18/pull/84 Tree-same-pre-rewrite: false --- flang/lib/parser/basic-parsers.h | 12 +++++++----- flang/lib/parser/idioms.h | 7 ++++--- flang/lib/parser/parse-tree.h | 3 +-- flang/lib/semantics/enum-set.h | 1 - 4 files changed, 12 insertions(+), 11 deletions(-) diff --git a/flang/lib/parser/basic-parsers.h b/flang/lib/parser/basic-parsers.h index 9b71421..500be4a 100644 --- a/flang/lib/parser/basic-parsers.h +++ b/flang/lib/parser/basic-parsers.h @@ -195,10 +195,11 @@ public: constexpr SequenceParser(const SequenceParser &) = default; constexpr SequenceParser(const PA &pa, const PB &pb) : pa_{pa}, pb_{pb} {} std::optional Parse(ParseState &state) const { + std::optional result; if (pa_.Parse(state)) { - return pb_.Parse(state); + result = pb_.Parse(state); } - return {}; + return result; } private: @@ -218,12 +219,13 @@ public: constexpr InvertedSequenceParser(const PA &pa, const PB &pb) : pa_{pa}, pb_{pb} {} std::optional Parse(ParseState &state) const { + std::optional result; if (std::optional ax{pa_.Parse(state)}) { if (pb_.Parse(state)) { - return ax; + result = std::move(ax); } } - return {}; + return result; } private: @@ -292,7 +294,7 @@ template inline constexpr auto first(const Ps &... ps) { #if !__GNUC__ || __clang__ // Implement operator|| with first(), unless compiling with g++, // which can segfault at compile time and needs to continue to use -// the original implementation of operator|| as of gcc-7.3.0. +// the original implementation of operator|| as of gcc-8.1.0. template inline constexpr auto operator||(const PA &pa, const PB &pb) { return first(pa, pb); diff --git a/flang/lib/parser/idioms.h b/flang/lib/parser/idioms.h index 18a4c74f..8272c8b 100644 --- a/flang/lib/parser/idioms.h +++ b/flang/lib/parser/idioms.h @@ -26,7 +26,7 @@ #error this is a C++17 program #endif #if !defined(__clang__) && defined __GNUC__ && __GNUC__ < 7 -#error G++ >= 7.0 is required +#error g++ >= 7.3 is required #endif #include @@ -35,14 +35,15 @@ #include #include -// Avoid a deduction bug in GNU 7.3.0 headers by forcing the answer. -// TODO: better resolution +#if __GNUC__ == 7 +// Avoid a deduction bug in GNU 7.x headers by forcing the answer. namespace std { template struct is_trivially_copy_constructible> : false_type {}; template struct is_trivially_copy_constructible>> : false_type {}; } // namespace std +#endif // enable "this is a std::string"s with the 's' suffix using namespace std::literals::string_literals; diff --git a/flang/lib/parser/parse-tree.h b/flang/lib/parser/parse-tree.h index 6f2dd4b..7a69d51 100644 --- a/flang/lib/parser/parse-tree.h +++ b/flang/lib/parser/parse-tree.h @@ -47,7 +47,7 @@ // Parse tree node class types do not have copy constructors or copy assignment // operators. They are explicitly declared "= delete;" to make this clear, // although a C++ compiler wouldn't default them anyway due to the presence -// of move constructors and move assignments. +// of explicitly defaulted move constructors and move assignments. CLASS_TRAIT(EmptyTrait); CLASS_TRAIT(WrapperTrait); @@ -710,7 +710,6 @@ struct SignedIntLiteralConstant { // R708 int-literal-constant -> digit-string [_ kind-param] struct IntLiteralConstant { TUPLE_CLASS_BOILERPLATE(IntLiteralConstant); - IntLiteralConstant(std::uint64_t n) : t{n, std::optional{}} {} std::tuple> t; }; diff --git a/flang/lib/semantics/enum-set.h b/flang/lib/semantics/enum-set.h index 017314e..33ad380 100644 --- a/flang/lib/semantics/enum-set.h +++ b/flang/lib/semantics/enum-set.h @@ -20,7 +20,6 @@ #include #include -#include namespace Fortran::semantics { -- 2.7.4