Skip to content

Commit ade5218

Browse files
committed
[SYCL] Workaround for bug in GCC older than 7.x
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56480 Signed-off-by: Vladimir Lazarev <[email protected]>
1 parent 4fbf5e0 commit ade5218

File tree

1 file changed

+10
-4
lines changed
  • sycl/include/CL/sycl/detail

1 file changed

+10
-4
lines changed

sycl/include/CL/sycl/detail/pi.hpp

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -169,25 +169,31 @@ void printArgs(Arg0 arg0, Args... args) {
169169

170170
namespace RT = cl::sycl::detail::pi;
171171

172+
// Workaround for build with GCC 5.x
173+
// An explicit specialization shall be declared in the namespace block.
174+
// Having namespace as part of template name is not supported by GCC
175+
// older than 7.x.
176+
// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56480
177+
namespace pi {
172178
// Want all the needed casts be explicit, do not define conversion
173179
// operators.
174-
template <class To, class From> To inline pi::cast(From value) {
180+
template <class To, class From> inline To cast(From value) {
175181
// TODO: see if more sanity checks are possible.
176182
RT::assertion((sizeof(From) == sizeof(To)), "assert: cast failed size check");
177183
return (To)(value);
178184
}
179185

180186
// These conversions should use PI interop API.
181-
template <> pi::PiProgram inline pi::cast(cl_program interop) {
187+
template <> inline pi::PiProgram cast(cl_program interop) {
182188
RT::assertion(false, "pi::cast -> use piextProgramConvert");
183189
return {};
184190
}
185191

186-
template <> pi::PiDevice inline pi::cast(cl_device_id interop) {
192+
template <> inline pi::PiDevice cast(cl_device_id interop) {
187193
RT::assertion(false, "pi::cast -> use piextDeviceConvert");
188194
return {};
189195
}
190-
196+
} // namespace pi
191197
} // namespace detail
192198

193199
// For shortness of using PI from the top-level sycl files.

0 commit comments

Comments
 (0)