Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions clang/lib/Sema/SemaSYCL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1903,6 +1903,10 @@ static void printArguments(ASTContext &Ctx, raw_ostream &ArgOS,
for (unsigned I = 0; I < Args.size(); I++) {
const TemplateArgument &Arg = Args[I];

// If argument is an empty pack argument, skip printing comma and argument.
if (Arg.getKind() == TemplateArgument::ArgKind::Pack && !Arg.pack_size())
continue;

if (I != 0)
ArgOS << ", ";

Expand Down
9 changes: 9 additions & 0 deletions clang/test/CodeGenSYCL/int_header1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
// CHECK:template <> struct KernelInfo<::nm1::KernelName4<KernelName7>> {
// CHECK:template <> struct KernelInfo<::nm1::KernelName8<::nm1::nm2::C>> {
// CHECK:template <> struct KernelInfo<::TmplClassInAnonNS<ClassInAnonNS>> {
// CHECK:template <> struct KernelInfo<::nm1::KernelName9<char>> {

// This test checks if the SYCL device compiler is able to generate correct
// integration header when the kernel name class is expressed in different
Expand Down Expand Up @@ -42,6 +43,9 @@ namespace nm1 {
template <> class KernelName4<nm1::nm2::KernelName0> {};
template <> class KernelName4<KernelName1> {};

template <typename T, typename...>
class KernelName9;

} // namespace nm1

namespace {
Expand Down Expand Up @@ -128,6 +132,10 @@ struct MyWrapper {
kernel_single_task<TmplClassInAnonNS<class ClassInAnonNS>>(
[=]() { acc.use(); });

// Kernel name type is a templated specialization class with empty template pack argument
kernel_single_task<nm1::KernelName9<char>>(
[=]() { acc.use(); });

return 0;
}
};
Expand All @@ -151,5 +159,6 @@ int main() {
KernelInfo<class nm1::KernelName4<class KernelName7>>::getName();
KernelInfo<class nm1::KernelName8<nm1::nm2::C>>::getName();
KernelInfo<class TmplClassInAnonNS<class ClassInAnonNS>>::getName();
KernelInfo<class nm1::KernelName9<char>>::getName();
#endif //__SYCL_DEVICE_ONLY__
}