Skip to content

Commit dc54a94

Browse files
mrkajetanpsivan-shani
authored andcommitted
[flang-rt] Explicitly define the default ShallowCopy* templates (llvm#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 <[email protected]>
1 parent f612cf3 commit dc54a94

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

flang-rt/lib/runtime/tools.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,10 @@ RT_API_ATTRS void ShallowCopyDiscontiguousToDiscontiguous(
136136
}
137137
}
138138

139+
// Explicitly instantiate the default case to conform to the C++ standard
140+
template RT_API_ATTRS void ShallowCopyDiscontiguousToDiscontiguous<char, -1>(
141+
const Descriptor &to, const Descriptor &from);
142+
139143
template <typename P, int RANK>
140144
RT_API_ATTRS void ShallowCopyDiscontiguousToContiguous(
141145
const Descriptor &to, const Descriptor &from) {
@@ -153,6 +157,9 @@ RT_API_ATTRS void ShallowCopyDiscontiguousToContiguous(
153157
}
154158
}
155159

160+
template RT_API_ATTRS void ShallowCopyDiscontiguousToContiguous<char, -1>(
161+
const Descriptor &to, const Descriptor &from);
162+
156163
template <typename P, int RANK>
157164
RT_API_ATTRS void ShallowCopyContiguousToDiscontiguous(
158165
const Descriptor &to, const Descriptor &from) {
@@ -170,6 +177,9 @@ RT_API_ATTRS void ShallowCopyContiguousToDiscontiguous(
170177
}
171178
}
172179

180+
template RT_API_ATTRS void ShallowCopyContiguousToDiscontiguous<char, -1>(
181+
const Descriptor &to, const Descriptor &from);
182+
173183
// ShallowCopy helper for calling the correct specialised variant based on
174184
// scenario
175185
template <typename P, int RANK = -1>

0 commit comments

Comments
 (0)