1 // RUN: %clang_cc1 -std=c++11 -fsyntax-only -fsycl-is-device -verify %s
3 // Only function templates
4 [[clang::sycl_kernel
]] int gv2
= 0; // expected-warning {{'sycl_kernel' attribute only applies to function templates}}
5 __attribute__((sycl_kernel
)) int gv3
= 0; // expected-warning {{'sycl_kernel' attribute only applies to function templates}}
7 __attribute__((sycl_kernel
)) void foo(); // expected-warning {{'sycl_kernel' attribute only applies to function templates}}
8 [[clang::sycl_kernel
]] void foo1(); // expected-warning {{'sycl_kernel' attribute only applies to function templates}}
10 // Attribute takes no arguments
11 template <typename T
, typename A
>
12 __attribute__((sycl_kernel(1))) void foo(T P
); // expected-error {{'sycl_kernel' attribute takes no arguments}}
13 template <typename T
, typename A
, int I
>
14 [[clang::sycl_kernel(1)]] void foo1(T P
);// expected-error {{'sycl_kernel' attribute takes no arguments}}
16 // At least two template parameters
18 __attribute__((sycl_kernel
)) void foo(T P
); // expected-warning {{'sycl_kernel' attribute only applies to a function template with at least two template parameters}}
20 [[clang::sycl_kernel
]] void foo1(T P
); // expected-warning {{'sycl_kernel' attribute only applies to a function template with at least two template parameters}}
22 // First two template parameters cannot be non-type template parameters
23 template <typename T
, int A
>
24 __attribute__((sycl_kernel
)) void foo(T P
); // expected-warning {{template parameter of a function template with the 'sycl_kernel' attribute cannot be a non-type template parameter}}
25 template <int A
, typename T
>
26 [[clang::sycl_kernel
]] void foo1(T P
); // expected-warning {{template parameter of a function template with the 'sycl_kernel' attribute cannot be a non-type template parameter}}
29 template <typename T
, typename A
>
30 __attribute__((sycl_kernel
)) int foo(T P
); // expected-warning {{function template with 'sycl_kernel' attribute must have a 'void' return type}}
31 template <typename T
, typename A
>
32 [[clang::sycl_kernel
]] int foo1(T P
); // expected-warning {{function template with 'sycl_kernel' attribute must have a 'void' return type}}
34 // Must take at least one argument
35 template <typename T
, typename A
>
36 __attribute__((sycl_kernel
)) void foo(); // expected-warning {{function template with 'sycl_kernel' attribute must have a single parameter}}
37 template <typename T
, typename A
>
38 [[clang::sycl_kernel
]] void foo1(T t
, A a
); // expected-warning {{function template with 'sycl_kernel' attribute must have a single parameter}}
41 template <typename T
, typename A
>
42 __attribute__((sycl_kernel
)) void foo(T P
);
43 template <typename T
, typename A
, int I
>
44 [[clang::sycl_kernel
]] void foo1(T P
);