1// RUN: %clang_cc1 %s -pedantic -verify -fsyntax-only
2
3struct C {
4  kernel void m(); //expected-error{{kernel functions cannot be class members}}
5};
6
7template <typename T>
8//expected-error@+1{{'T' cannot be used as the type of a kernel parameter}}
9kernel void templ(T par) { //expected-error{{kernel functions cannot be used in a template declaration, instantiation or specialization}}
10}
11
12template <int>
13kernel void bar(int par) { //expected-error{{kernel functions cannot be used in a template declaration, instantiation or specialization}}
14}
15
16kernel void foo(int); //expected-note{{previous declaration is here}}
17
18kernel void foo(float); //expected-error{{conflicting types for 'foo'}}
19
20kernel void int_v(int in);
21kernel void int_p(__global int *in);
22kernel void int_r(__global int &in);
23kernel void int_p_p(__global int *__global *in);
24kernel void int_p_r(__global int *__global &in);
25kernel void int_p_p_r(__global int *__global *__global &in);
26
27// expected-error@+1{{'__private atomic_int' (aka '__private _Atomic(int)') cannot be used as the type of a kernel parameter}}
28kernel void k_atomic_v(atomic_int in);
29kernel void k_atomic_p(__global atomic_int *in);
30kernel void k_atomic_r(__global atomic_int &in);
31
32kernel void k_pipe(read_only pipe int in, write_only pipe int out);
33kernel void k_sampler(sampler_t in);
34kernel void k_void(__global void *in);
35
36typedef int int4 __attribute__((ext_vector_type(4)));
37
38kernel void int4_v(int4 in);
39kernel void int4_p(__global int4 *in);
40kernel void int4_p_p(__global int4 *__global *in);
41kernel void int4_r(__global int4 &in);
42
43struct POD {
44  int a;
45  int b;
46};
47
48kernel void pod_v(POD in) {}
49kernel void pod_p(__global POD *in) {}
50kernel void pod_p_p(__global POD *__global *in) {}
51kernel void pod_r(__global POD &in) {}
52
53struct StandardLayout {
54  int a;
55  int b;
56  StandardLayout(int a, int b) : a(a), b(b) {}
57};
58
59kernel void standard_v(StandardLayout in) {} //expected-error{{'__private StandardLayout' cannot be used as the type of a kernel parameter}}
60kernel void standard_p(__global StandardLayout *in) {}
61kernel void standard_p_p(__global StandardLayout *__global *in) {}
62kernel void standard_r(__global StandardLayout &in) {}
63
64struct Trivial {
65  int a;
66private:
67  int b;
68};
69
70kernel void trivial_v(Trivial in) {} //expected-error{{'__private Trivial' cannot be used as the type of a kernel parameter}}
71kernel void trivial_p(__global Trivial *in) {} //expected-error{{'__global Trivial *__private' cannot be used as the type of a kernel parameter}}
72kernel void trivial_p_p(__global Trivial *__global *in) {} //expected-error{{'__global Trivial *__global *__private' cannot be used as the type of a kernel parameter}}
73kernel void trivial_r(__global Trivial &in) {} //expected-error{{'__global Trivial &__private' cannot be used as the type of a kernel parameter}}
74