[flang] Fix a warning
authorKazu Hirata <kazu@google.com>
Sat, 23 Jul 2022 00:56:10 +0000 (17:56 -0700)
committerKazu Hirata <kazu@google.com>
Sat, 23 Jul 2022 00:56:10 +0000 (17:56 -0700)
This patch fixes:

  llvm-project/flang/lib/Semantics/expression.cpp:405:12: error:
  moving a local object in a return statement prevents copy elision
  [-Werror,-Wpessimizing-move]

flang/lib/Semantics/expression.cpp

index d8b3f5e..d4492d2 100644 (file)
@@ -402,7 +402,7 @@ MaybeExpr ExpressionAnalyzer::FixMisparsedSubstring(
 MaybeExpr ExpressionAnalyzer::Analyze(const parser::Designator &d) {
   auto restorer{GetContextualMessages().SetLocation(d.source)};
   if (auto substringInquiry{FixMisparsedSubstring(d)}) {
-    return std::move(substringInquiry);
+    return substringInquiry;
   }
   // These checks have to be deferred to these "top level" data-refs where
   // we can be sure that there are no following subscripts (yet).