[flang] Changes that might fix MSVC build problems from sjs
authorpeter klausler <pklausler@nvidia.com>
Mon, 17 Sep 2018 17:07:25 +0000 (10:07 -0700)
committerpeter klausler <pklausler@nvidia.com>
Tue, 25 Sep 2018 22:23:59 +0000 (15:23 -0700)
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
flang/lib/parser/basic-parsers.h
flang/lib/semantics/expression.cc

index a80ca3a..e3730f3 100644 (file)
@@ -32,6 +32,7 @@
 #include <functional>
 #include <list>
 #include <optional>
+#include <string>
 #include <tuple>
 #include <type_traits>
 #include <variant>
index 47790df..4c6015d 100644 (file)
@@ -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<const char *> 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<LF>(a)
 // is a parser that optionally enabled, sets a strict conformance violation
index ce99417..de09f4b 100644 (file)
@@ -536,9 +536,8 @@ std::optional<DataRef> AsDataRef(Expr<Type<CAT, KIND>> &&expr) {
           using Ty = std::decay_t<decltype(x)>;
           if constexpr (common::HasMember<Ty, decltype(DataRef::u)>) {
             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<semantics::TypeParamDetails>()}) {
+      } else if (sym->detailsIf<semantics::TypeParamDetails>()) {
         context.messages.Say(sc.component.source,
             "TODO: type parameter inquiry unimplemented"_err_en_US);
       } else if (&sym->owner() != dtExpr->result.spec().scope()) {