Skip to content

Commit e98cb36

Browse files
authored
[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.
1 parent 500dda0 commit e98cb36

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

flang/lib/Evaluate/fold-implementation.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1686,7 +1686,7 @@ Expr<TO> FoldOperation(
16861686
Convert<TO, FROMCAT> &convert;
16871687
} msvcWorkaround{context, convert};
16881688
return common::visit(
1689-
[&msvcWorkaround, &context](auto &kindExpr) -> Expr<TO> {
1689+
[&msvcWorkaround](auto &kindExpr) -> Expr<TO> {
16901690
using Operand = ResultType<decltype(kindExpr)>;
16911691
// This variable is a workaround for msvc which emits an error when
16921692
// using the FROMCAT template parameter below.
@@ -1699,7 +1699,7 @@ Expr<TO> FoldOperation(
16991699
if constexpr (FromCat == TypeCategory::Integer) {
17001700
auto converted{Scalar<TO>::ConvertSigned(*value)};
17011701
if (converted.overflow &&
1702-
context.languageFeatures().ShouldWarn(
1702+
msvcWorkaround.context.languageFeatures().ShouldWarn(
17031703
common::UsageWarning::FoldingException)) {
17041704
ctx.messages().Say(
17051705
"INTEGER(%d) to INTEGER(%d) conversion overflowed"_warn_en_US,
@@ -1708,7 +1708,7 @@ Expr<TO> FoldOperation(
17081708
return ScalarConstantToExpr(std::move(converted.value));
17091709
} else if constexpr (FromCat == TypeCategory::Real) {
17101710
auto converted{value->template ToInteger<Scalar<TO>>()};
1711-
if (context.languageFeatures().ShouldWarn(
1711+
if (msvcWorkaround.context.languageFeatures().ShouldWarn(
17121712
common::UsageWarning::FoldingException)) {
17131713
if (converted.flags.test(RealFlag::InvalidArgument)) {
17141714
ctx.messages().Say(

0 commit comments

Comments
 (0)