[flang] Dodge bogus warning about unused anonymous variable in refactored code.
authorpeter klausler <pklausler@nvidia.com>
Tue, 15 May 2018 23:40:22 +0000 (16:40 -0700)
committerpeter klausler <pklausler@nvidia.com>
Wed, 16 May 2018 16:59:42 +0000 (09:59 -0700)
Original-commit: flang-compiler/f18@1d3cfe003806254e8c4d6981d62d52dffa76be77
Reviewed-on: https://github.com/flang-compiler/f18/pull/90
Tree-same-pre-rewrite: false

flang/lib/parser/token-parsers.h

index f19bd71f7f76504d97d258131203b591d58c57e6..cb35a4d3aa7af5ef1b283ef164898e8c12893e92 100644 (file)
@@ -450,11 +450,12 @@ constexpr struct SkipDigitString {
 // N.B. Spaces are consumed before and after the sign, since the sign
 // and the int-literal-constant are distinct tokens.  Does not
 // handle a trailing kind parameter.
-static inline constexpr std::optional<std::int64_t> SignedInteger(
+static std::optional<std::int64_t> SignedInteger(
     const std::optional<std::uint64_t> &x, Location at, bool negate,
     ParseState &state) {
+  std::optional<std::int64_t> result;
   if (!x.has_value()) {
-    return {};
+    return result;
   }
   std::uint64_t limit{std::numeric_limits<std::int64_t>::max()};
   if (negate) {
@@ -464,7 +465,8 @@ static inline constexpr std::optional<std::int64_t> SignedInteger(
     state.Say(at, "overflow in signed decimal literal"_err_en_US);
   }
   std::int64_t value = *x;
-  return {negate ? -value : value};
+  result = negate ? -value : value;
+  return result;
 }
 
 struct SignedIntLiteralConstantWithoutKind {