From c2d4f07cda6fc97cd18194d9e0780896307c48e1 Mon Sep 17 00:00:00 2001 From: peter klausler Date: Mon, 17 Sep 2018 10:07:25 -0700 Subject: [PATCH] [flang] Changes that might fix MSVC build problems from sjs Original-commit: flang-compiler/f18@009f0cc8df923a5025df08b935c2776a5e7d2165 Reviewed-on: https://github.com/flang-compiler/f18/pull/195 Tree-same-pre-rewrite: false --- flang/lib/common/idioms.h | 1 + flang/lib/parser/basic-parsers.h | 6 ++++-- flang/lib/semantics/expression.cc | 6 ++---- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/flang/lib/common/idioms.h b/flang/lib/common/idioms.h index a80ca3a38dc1..e3730f3e4caf 100644 --- a/flang/lib/common/idioms.h +++ b/flang/lib/common/idioms.h @@ -32,6 +32,7 @@ #include #include #include +#include #include #include #include diff --git a/flang/lib/parser/basic-parsers.h b/flang/lib/parser/basic-parsers.h index 47790df085f0..4c6015d505e0 100644 --- a/flang/lib/parser/basic-parsers.h +++ b/flang/lib/parser/basic-parsers.h @@ -1256,7 +1256,7 @@ inline constexpr auto localRecovery( // nextCh is a parser that succeeds if the parsing state is not // at the end of its input, returning the next character location and // advancing the parse when it does so. -constexpr struct NextCh { +struct NextCh { using resultType = const char *; constexpr NextCh() {} std::optional Parse(ParseState &state) const { @@ -1266,7 +1266,9 @@ constexpr struct NextCh { state.Say("end of file"_err_en_US); return std::nullopt; } -} nextCh; +}; + +constexpr NextCh nextCh; // If a is a parser for some nonstandard language feature LF, extension(a) // is a parser that optionally enabled, sets a strict conformance violation diff --git a/flang/lib/semantics/expression.cc b/flang/lib/semantics/expression.cc index ce99417e38df..de09f4b60c91 100644 --- a/flang/lib/semantics/expression.cc +++ b/flang/lib/semantics/expression.cc @@ -536,9 +536,8 @@ std::optional AsDataRef(Expr> &&expr) { using Ty = std::decay_t; if constexpr (common::HasMember) { return {DataRef{std::move(x)}}; - } else { - return std::nullopt; } + return std::nullopt; }, std::move(designator->u)); } else { @@ -615,8 +614,7 @@ MaybeExpr ExprAnalyzer::Analyze(const parser::StructureComponent &sc) { if (sym == nullptr) { context.messages.Say(sc.component.source, "component name was not resolved to a symbol"_err_en_US); - } else if (const auto *tpDetails{ - sym->detailsIf()}) { + } else if (sym->detailsIf()) { context.messages.Say(sc.component.source, "TODO: type parameter inquiry unimplemented"_err_en_US); } else if (&sym->owner() != dtExpr->result.spec().scope()) { -- 2.34.1