summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Klausler <35819229+klausler@users.noreply.github.com>2024-05-01 15:15:52 -0700
committerGitHub <noreply@github.com>2024-05-01 15:15:52 -0700
commite98cb360884db03a90f148a8454bb07152621e8a (patch)
tree56f79e83a4da1c17db90177053a455ab967c9f72
parent500dda049ea1b140a888f284b3c512cd77af6fce (diff)
[flang][build] Fix build warning (#90789)
Fix a warning from some build compilers about an unused lambda capture. There are some `if constexpr` branches in the body of the code that do not use the capture.
-rw-r--r--flang/lib/Evaluate/fold-implementation.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/flang/lib/Evaluate/fold-implementation.h b/flang/lib/Evaluate/fold-implementation.h
index e3b49449b888..d5c393140c57 100644
--- a/flang/lib/Evaluate/fold-implementation.h
+++ b/flang/lib/Evaluate/fold-implementation.h
@@ -1686,7 +1686,7 @@ Expr<TO> FoldOperation(
Convert<TO, FROMCAT> &convert;
} msvcWorkaround{context, convert};
return common::visit(
- [&msvcWorkaround, &context](auto &kindExpr) -> Expr<TO> {
+ [&msvcWorkaround](auto &kindExpr) -> Expr<TO> {
using Operand = ResultType<decltype(kindExpr)>;
// This variable is a workaround for msvc which emits an error when
// using the FROMCAT template parameter below.
@@ -1699,7 +1699,7 @@ Expr<TO> FoldOperation(
if constexpr (FromCat == TypeCategory::Integer) {
auto converted{Scalar<TO>::ConvertSigned(*value)};
if (converted.overflow &&
- context.languageFeatures().ShouldWarn(
+ msvcWorkaround.context.languageFeatures().ShouldWarn(
common::UsageWarning::FoldingException)) {
ctx.messages().Say(
"INTEGER(%d) to INTEGER(%d) conversion overflowed"_warn_en_US,
@@ -1708,7 +1708,7 @@ Expr<TO> FoldOperation(
return ScalarConstantToExpr(std::move(converted.value));
} else if constexpr (FromCat == TypeCategory::Real) {
auto converted{value->template ToInteger<Scalar<TO>>()};
- if (context.languageFeatures().ShouldWarn(
+ if (msvcWorkaround.context.languageFeatures().ShouldWarn(
common::UsageWarning::FoldingException)) {
if (converted.flags.test(RealFlag::InvalidArgument)) {
ctx.messages().Say(