diff --git a/flang-rt/lib/runtime/matmul-transpose.cpp b/flang-rt/lib/runtime/matmul-transpose.cpp index e20abbdddcd3..8666167e1947 100644 --- a/flang-rt/lib/runtime/matmul-transpose.cpp +++ b/flang-rt/lib/runtime/matmul-transpose.cpp @@ -331,6 +331,7 @@ template ; + using ResultTy = Fortran::common::optional>; RT_API_ATTRS void operator()(ResultDescriptor &result, const Descriptor &x, const Descriptor &y, const char *sourceFile, int line) const { Terminator terminator{sourceFile, line}; @@ -339,7 +340,7 @@ struct MatmulTransposeHelper { RUNTIME_CHECK(terminator, xCatKind.has_value() && yCatKind.has_value()); RUNTIME_CHECK(terminator, xCatKind->first == XCAT); RUNTIME_CHECK(terminator, yCatKind->first == YCAT); - if constexpr (constexpr auto resultType{ + if constexpr (constexpr ResultTy resultType{ GetResultType(XCAT, XKIND, YCAT, YKIND)}) { return DoMatmulTransposefirst, resultType->second, CppTypeFor, CppTypeFor>( diff --git a/flang-rt/lib/runtime/matmul.cpp b/flang-rt/lib/runtime/matmul.cpp index f14cea922d21..693e51082bd4 100644 --- a/flang-rt/lib/runtime/matmul.cpp +++ b/flang-rt/lib/runtime/matmul.cpp @@ -424,6 +424,7 @@ static inline RT_API_ATTRS void DoMatmul( template struct MatmulHelper { + using ResultTy = Fortran::common::optional>; using ResultDescriptor = std::conditional_t; RT_API_ATTRS void operator()(ResultDescriptor &result, const Descriptor &x, @@ -439,7 +440,7 @@ struct MatmulHelper { xCatKind->first == TypeCategory::Unsigned) && (yCatKind->first == TypeCategory::Integer || yCatKind->first == TypeCategory::Unsigned)))); - if constexpr (constexpr auto resultType{ + if constexpr (constexpr ResultTy resultType{ GetResultType(XCAT, XKIND, YCAT, YKIND)}) { return DoMatmulfirst, resultType->second, CppTypeFor, CppTypeFor>(