From 09a70b1e10afc03c85767fccd518e6a66585972a Mon Sep 17 00:00:00 2001 From: Kajetan Puchalski Date: Tue, 27 May 2025 16:38:48 +0100 Subject: [PATCH] [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 --- flang-rt/lib/runtime/tools.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/flang-rt/lib/runtime/tools.cpp b/flang-rt/lib/runtime/tools.cpp index 027e1b0a4fb3..b08195cd31e0 100644 --- a/flang-rt/lib/runtime/tools.cpp +++ b/flang-rt/lib/runtime/tools.cpp @@ -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( + const Descriptor &to, const Descriptor &from); + template RT_API_ATTRS void ShallowCopyDiscontiguousToContiguous( const Descriptor &to, const Descriptor &from) { @@ -153,6 +157,9 @@ RT_API_ATTRS void ShallowCopyDiscontiguousToContiguous( } } +template RT_API_ATTRS void ShallowCopyDiscontiguousToContiguous( + const Descriptor &to, const Descriptor &from); + template RT_API_ATTRS void ShallowCopyContiguousToDiscontiguous( const Descriptor &to, const Descriptor &from) { @@ -170,6 +177,9 @@ RT_API_ATTRS void ShallowCopyContiguousToDiscontiguous( } } +template RT_API_ATTRS void ShallowCopyContiguousToDiscontiguous( + const Descriptor &to, const Descriptor &from); + // ShallowCopy helper for calling the correct specialised variant based on // scenario template