Skip to content

Commit 7bc7672

Browse files
[flang] Fix compilation errors due to new clang template requirements (#94204)
Since #80801 clang requires a template argument list after the use of the template keyword. https://lab.llvm.org/buildbot/#/builders/176/builds/10230 error: a template argument list is expected after a name prefixed by the template keyword [-Wmissing-template-arg-list-after-template-kw] This fixes the instances found by the AArch64 Linux builds.
1 parent b301a98 commit 7bc7672

File tree

3 files changed

+9
-8
lines changed

3 files changed

+9
-8
lines changed

flang/include/flang/Evaluate/integer.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ class Integer {
315315
}
316316
result.overflow = false;
317317
} else if constexpr (bits < FROM::bits) {
318-
auto back{FROM::template ConvertSigned(result.value)};
318+
auto back{FROM::template ConvertSigned<Integer>(result.value)};
319319
result.overflow = back.value.CompareUnsigned(that) != Ordering::Equal;
320320
}
321321
return result;

flang/lib/Evaluate/fold-real.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -381,13 +381,14 @@ Expr<Type<TypeCategory::Real, KIND>> FoldIntrinsicFunction(
381381
std::move(funcRef),
382382
ScalarFunc<T, T, TBY>(
383383
[&](const Scalar<T> &x, const Scalar<TBY> &y) -> Scalar<T> {
384-
ValueWithRealFlags<Scalar<T>> result{x.
384+
ValueWithRealFlags<Scalar<T>> result{
385+
x.
385386
// MSVC chokes on the keyword "template" here in a call to a
386387
// member function template.
387388
#ifndef _MSC_VER
388-
template
389+
template
389390
#endif
390-
SCALE(y)};
391+
SCALE<Scalar<TBY>>(y)};
391392
if (result.flags.test(RealFlag::Overflow) &&
392393
context.languageFeatures().ShouldWarn(
393394
common::UsageWarning::FoldingException)) {

flang/runtime/reduction-templates.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,14 +91,14 @@ inline RT_API_ATTRS CppTypeFor<CAT, KIND> GetTotalReduction(const Descriptor &x,
9191
#ifdef _MSC_VER // work around MSVC spurious error
9292
accumulator.GetResult();
9393
#else
94-
accumulator.template GetResult();
94+
accumulator.template GetResult<CppType>();
9595
#endif
9696
} else {
9797
CppType result;
9898
#ifdef _MSC_VER // work around MSVC spurious error
9999
accumulator.GetResult(&result);
100100
#else
101-
accumulator.template GetResult(&result);
101+
accumulator.template GetResult<CppType>(&result);
102102
#endif
103103
return result;
104104
}
@@ -141,7 +141,7 @@ inline RT_API_ATTRS void ReduceDimToScalar(const Descriptor &x,
141141
#ifdef _MSC_VER // work around MSVC spurious error
142142
accumulator.GetResult(result, zeroBasedDim);
143143
#else
144-
accumulator.template GetResult(result, zeroBasedDim);
144+
accumulator.template GetResult<TYPE>(result, zeroBasedDim);
145145
#endif
146146
}
147147

@@ -169,7 +169,7 @@ inline RT_API_ATTRS void ReduceDimMaskToScalar(const Descriptor &x,
169169
#ifdef _MSC_VER // work around MSVC spurious error
170170
accumulator.GetResult(result, zeroBasedDim);
171171
#else
172-
accumulator.template GetResult(result, zeroBasedDim);
172+
accumulator.template GetResult<TYPE>(result, zeroBasedDim);
173173
#endif
174174
}
175175

0 commit comments

Comments
 (0)