// RUN: %clang_cc1 %s -std=c++17 -triple x86_64-pc-windows-msvc -fsycl-is-device -verify -fsyntax-only -Wno-unused // RUN: %clang_cc1 %s -std=c++17 -triple x86_64-linux-gnu -fsycl-is-device -verify -fsyntax-only -Wno-unused template [[clang::sycl_kernel]] void kernel_single_task(KernelType kernelFunc) { // #kernelSingleTask kernelFunc(); } // kernel1 - expect error // The current function is named with a lambda (i.e., takes a lambda as a // template parameter. Call the builtin on the current function then it is // passed to a kernel. Test that passing the given function to the unique // stable name builtin and then to the kernel throws an error because the // latter causes its name mangling to change. template void kernel1func(const Func &F1) { constexpr const char *F1_output = __builtin_sycl_unique_stable_name(Func); // #USN_F1 kernel_single_task(F1); // #kernel1_call } void callkernel1() { kernel1func([]() {}); // #kernel1func_call } // kernel2 - expect error // The current function is named with a lambda (i.e., takes a lambda as a // template parameter). Call the builtin on the given function, // then an empty lambda is passed to kernel. // Test that passing the given function to the unique stable name builtin and // then passing a different lambda to the kernel still throws an error because // the calling context is part of naming the kernel. Even though the given // function (F2) is not passed to the kernel, its mangling changes due to // kernel call with the unrelated lambda. template void kernel2func(const Func &F2) { constexpr const char *F2_output = __builtin_sycl_unique_stable_name(Func); // #USN_F2 kernel_single_task([]() {}); } void callkernel2() { kernel2func([]() {}); // #kernel2func_call } template