From 7aa77c5a6712a81116d232f789a1fdf36252cad0 Mon Sep 17 00:00:00 2001 From: Kazu Hirata Date: Fri, 22 Jul 2022 17:56:10 -0700 Subject: [PATCH] [flang] Fix a warning 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 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flang/lib/Semantics/expression.cpp b/flang/lib/Semantics/expression.cpp index d8b3f5e..d4492d2 100644 --- a/flang/lib/Semantics/expression.cpp +++ b/flang/lib/Semantics/expression.cpp @@ -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). -- 2.7.4