Files
TheRock/compiler/amd-llvm/clang/test/SemaSYCL/sycl-kernel-launch-ms-compat.cpp
derek.holloway 7502bf64a4
CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
Flatten subprojects into a single base monorepo
2026-09-02 16:34:47 -07:00

89 lines
3.9 KiB
C++

// RUN: %clang_cc1 -triple x86_64-pc-windows-msvc -std=c++20 -fsyntax-only -fsycl-is-host -fms-compatibility -fcxx-exceptions -verify=host,expected %s
// RUN: %clang_cc1 -triple spirv64-unknown-unknown -std=c++20 -fsyntax-only -fsycl-is-device -fms-compatibility -verify=device,expected %s
// Test Microsoft extensions for lookup of a sycl_kernel_launch member template
// in a dependent base class.
////////////////////////////////////////////////////////////////////////////////
// Valid declarations.
////////////////////////////////////////////////////////////////////////////////
// A unique kernel name type is required for each declared kernel entry point.
template<int> struct KN;
// A generic kernel object type.
template<int>
struct KT {
void operator()() const;
};
namespace ok1 {
template<typename Derived>
struct base_handler {
protected:
// expected-note@+2 {{must qualify identifier to find this declaration in dependent base class}}
template<typename KN, typename... Ts>
void sycl_kernel_launch(const char *, Ts...);
};
template<int N>
struct handler : protected base_handler<handler<N>> {
// A warning is issued because, in standard C++, unqualified lookup for
// sycl_kernel_launch would not consider dependent base classes. Such
// lookups are allowed as a Microsoft compatible extension.
// expected-warning@+4 {{use of member 'sycl_kernel_launch' found via unqualified lookup into dependent bases of class templates is a Microsoft extension}}
// expected-note@+2 {{this indicates a problem with the SYCL runtime header files; please consider reporting this to your SYCL runtime provider}}
// expected-note-re@+1 {{in implicit call to 'sycl_kernel_launch' with template argument 'KN<1>' and function arguments (lvalue of type 'const char[{{[0-9]*}}]', xvalue of type 'KT<1>') required here}}
[[clang::sycl_kernel_entry_point(KN<1>)]]
void skep(KT<1> k) {
k();
}
};
// expected-note@+1 {{in instantiation of member function 'ok1::handler<1>::skep' requested here}}
template void handler<1>::skep(KT<1>);
}
////////////////////////////////////////////////////////////////////////////////
// Invalid declarations.
////////////////////////////////////////////////////////////////////////////////
// A unique kernel name type is required for each declared kernel entry point.
template<int> struct BADKN;
// A generic kernel object type.
template<int>
struct BADKT {
void operator()() const;
};
namespace bad1 {
template<typename Derived>
struct base_handler {
private:
// expected-note@+3 {{must qualify identifier to find this declaration in dependent base class}}
// expected-note@+2 {{declared private here}}
template<typename KN, typename... Ts>
void sycl_kernel_launch(const char *, Ts...);
};
template<int N>
struct handler : protected base_handler<handler<N>> {
// In standard C++, unqualified lookup for sycl_kernel_launch would not
// consider dependent base classes. Such lookups are allowed as a Microsoft
// compatible extension, but access checks are still performed which makes
// this case an error.
// expected-warning@+5 {{use of member 'sycl_kernel_launch' found via unqualified lookup into dependent bases of class templates is a Microsoft extension}}
// expected-note@+3 {{this indicates a problem with the SYCL runtime header files; please consider reporting this to your SYCL runtime provider}}
// expected-note-re@+2 {{in implicit call to 'sycl_kernel_launch' with template argument 'BADKN<1>' and function arguments (lvalue of type 'const char[{{[0-9]*}}]', xvalue of type 'BADKT<1>') required here}}
// expected-error@+2 {{'sycl_kernel_launch' is a private member of 'bad1::base_handler<bad1::handler<1>>'}}
[[clang::sycl_kernel_entry_point(BADKN<1>)]]
void skep(BADKT<1> k) {
k();
}
};
// expected-note@+1 {{in instantiation of member function 'bad1::handler<1>::skep' requested here}}
template void handler<1>::skep(BADKT<1>);
}