diff --git a/flang-rt/lib/runtime/matmul-transpose.cpp b/flang-rt/lib/runtime/matmul-transpose.cpp index 789f13c585ec5..c2efe30a49e46 100644 --- a/flang-rt/lib/runtime/matmul-transpose.cpp +++ b/flang-rt/lib/runtime/matmul-transpose.cpp @@ -340,8 +340,8 @@ 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 ResultTy resultType{ - GetResultType(XCAT, XKIND, YCAT, YKIND)}) { + constexpr ResultTy resultType{GetResultType(XCAT, XKIND, YCAT, YKIND)}; + if constexpr (resultType) { return DoMatmulTransposefirst, resultType->second, CppTypeFor, CppTypeFor>( result, x, y, terminator); diff --git a/flang-rt/lib/runtime/matmul.cpp b/flang-rt/lib/runtime/matmul.cpp index d409cb1458c90..611935a1c8e1b 100644 --- a/flang-rt/lib/runtime/matmul.cpp +++ b/flang-rt/lib/runtime/matmul.cpp @@ -440,8 +440,8 @@ struct MatmulHelper { xCatKind->first == TypeCategory::Unsigned) && (yCatKind->first == TypeCategory::Integer || yCatKind->first == TypeCategory::Unsigned)))); - if constexpr (constexpr ResultTy resultType{ - GetResultType(XCAT, XKIND, YCAT, YKIND)}) { + constexpr ResultTy resultType{GetResultType(XCAT, XKIND, YCAT, YKIND)}; + if constexpr (resultType) { return DoMatmulfirst, resultType->second, CppTypeFor, CppTypeFor>( result, x, y, terminator);