[flang-rt] Explicitly define the default ShallowCopy* templates (#141619)

Not explicitly defining the default case for ShallowCopy* functions does
not meet the requirements for gcc to actually instantiate the templates,
leading to build errors that show up with gcc but not with clang.

Signed-off-by: Kajetan Puchalski <kajetan.puchalski@arm.com>
This commit is contained in:
Kajetan Puchalski
2025-05-27 16:38:48 +01:00
committed by GitHub
parent cc5237c7af
commit 09a70b1e10

View File

@@ -136,6 +136,10 @@ RT_API_ATTRS void ShallowCopyDiscontiguousToDiscontiguous(
} }
} }
// Explicitly instantiate the default case to conform to the C++ standard
template RT_API_ATTRS void ShallowCopyDiscontiguousToDiscontiguous<char, -1>(
const Descriptor &to, const Descriptor &from);
template <typename P, int RANK> template <typename P, int RANK>
RT_API_ATTRS void ShallowCopyDiscontiguousToContiguous( RT_API_ATTRS void ShallowCopyDiscontiguousToContiguous(
const Descriptor &to, const Descriptor &from) { const Descriptor &to, const Descriptor &from) {
@@ -153,6 +157,9 @@ RT_API_ATTRS void ShallowCopyDiscontiguousToContiguous(
} }
} }
template RT_API_ATTRS void ShallowCopyDiscontiguousToContiguous<char, -1>(
const Descriptor &to, const Descriptor &from);
template <typename P, int RANK> template <typename P, int RANK>
RT_API_ATTRS void ShallowCopyContiguousToDiscontiguous( RT_API_ATTRS void ShallowCopyContiguousToDiscontiguous(
const Descriptor &to, const Descriptor &from) { const Descriptor &to, const Descriptor &from) {
@@ -170,6 +177,9 @@ RT_API_ATTRS void ShallowCopyContiguousToDiscontiguous(
} }
} }
template RT_API_ATTRS void ShallowCopyContiguousToDiscontiguous<char, -1>(
const Descriptor &to, const Descriptor &from);
// ShallowCopy helper for calling the correct specialised variant based on // ShallowCopy helper for calling the correct specialised variant based on
// scenario // scenario
template <typename P, int RANK = -1> template <typename P, int RANK = -1>