Skip to content

[flang] Fix compilation errors due to new clang template requirements #94204

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion flang/include/flang/Evaluate/integer.h
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ class Integer {
}
result.overflow = false;
} else if constexpr (bits < FROM::bits) {
auto back{FROM::template ConvertSigned(result.value)};
auto back{FROM::template ConvertSigned<Integer>(result.value)};
result.overflow = back.value.CompareUnsigned(that) != Ordering::Equal;
}
return result;
Expand Down
7 changes: 4 additions & 3 deletions flang/lib/Evaluate/fold-real.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -381,13 +381,14 @@ Expr<Type<TypeCategory::Real, KIND>> FoldIntrinsicFunction(
std::move(funcRef),
ScalarFunc<T, T, TBY>(
[&](const Scalar<T> &x, const Scalar<TBY> &y) -> Scalar<T> {
ValueWithRealFlags<Scalar<T>> result{x.
ValueWithRealFlags<Scalar<T>> result{
x.
// MSVC chokes on the keyword "template" here in a call to a
// member function template.
#ifndef _MSC_VER
template
template
#endif
SCALE(y)};
SCALE<Scalar<TBY>>(y)};
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-format complains about the whitespace here, hence the change. The intent of the change is still clear, so I included it.

if (result.flags.test(RealFlag::Overflow) &&
context.languageFeatures().ShouldWarn(
common::UsageWarning::FoldingException)) {
Expand Down
8 changes: 4 additions & 4 deletions flang/runtime/reduction-templates.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,14 +91,14 @@ inline RT_API_ATTRS CppTypeFor<CAT, KIND> GetTotalReduction(const Descriptor &x,
#ifdef _MSC_VER // work around MSVC spurious error
accumulator.GetResult();
#else
accumulator.template GetResult();
accumulator.template GetResult<CppType>();
#endif
} else {
CppType result;
#ifdef _MSC_VER // work around MSVC spurious error
accumulator.GetResult(&result);
#else
accumulator.template GetResult(&result);
accumulator.template GetResult<CppType>(&result);
#endif
return result;
}
Expand Down Expand Up @@ -141,7 +141,7 @@ inline RT_API_ATTRS void ReduceDimToScalar(const Descriptor &x,
#ifdef _MSC_VER // work around MSVC spurious error
accumulator.GetResult(result, zeroBasedDim);
#else
accumulator.template GetResult(result, zeroBasedDim);
accumulator.template GetResult<TYPE>(result, zeroBasedDim);
#endif
}

Expand Down Expand Up @@ -169,7 +169,7 @@ inline RT_API_ATTRS void ReduceDimMaskToScalar(const Descriptor &x,
#ifdef _MSC_VER // work around MSVC spurious error
accumulator.GetResult(result, zeroBasedDim);
#else
accumulator.template GetResult(result, zeroBasedDim);
accumulator.template GetResult<TYPE>(result, zeroBasedDim);
#endif
}

Expand Down
Loading