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
6 changes: 6 additions & 0 deletions clang/test/SemaSYCL/Inputs/sycl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,12 @@ class handler {
}
};

namespace experimental {

template <typename T, typename ID = T>
class spec_constant {};
} // namespace experimental

} // namespace sycl
} // namespace cl

Expand Down
19 changes: 19 additions & 0 deletions clang/test/SemaSYCL/spec_const_and_accesor_crash.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// RUN: %clang_cc1 -fsycl -fsycl-is-device -fsyntax-only -I %S/Inputs -ast-dump %s | FileCheck %s
// The test checks that Clang doesn't crash if a specialization constant gets
// into the kernel capture list before an accessor

#include <sycl.hpp>

template <typename name, typename Func>
__attribute__((sycl_kernel)) void kernel(Func kernelFunc) {
kernelFunc();
}

int main() {
cl::sycl::experimental::spec_constant<char, class MyInt32Const> spec_const;
cl::sycl::accessor<int, 1, cl::sycl::access::mode::read_write> accessor;
// CHECK: FieldDecl {{.*}} implicit referenced 'cl::sycl::experimental::spec_constant<char, class MyInt32Const>'
// CHECK: FieldDecl {{.*}} implicit referenced 'cl::sycl::accessor<int, 1, cl::sycl::access::mode::read_write>'
kernel<class MyKernel>([spec_const, accessor]() {});
return 0;
}