xref: /minix3/external/bsd/llvm/dist/clang/test/SemaCUDA/kernel-call.cu (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1f4a2713aSLionel Sambuc // RUN: %clang_cc1 -fsyntax-only -verify %s
2f4a2713aSLionel Sambuc 
3*0a6a1f1dSLionel Sambuc #include "Inputs/cuda.h"
4f4a2713aSLionel Sambuc 
g1(int x)5f4a2713aSLionel Sambuc __global__ void g1(int x) {}
6f4a2713aSLionel Sambuc 
t1(T arg)7f4a2713aSLionel Sambuc template <typename T> void t1(T arg) {
8f4a2713aSLionel Sambuc   g1<<<arg, arg>>>(1);
9f4a2713aSLionel Sambuc }
10f4a2713aSLionel Sambuc 
h1(int x)11f4a2713aSLionel Sambuc void h1(int x) {}
h2(int x)12f4a2713aSLionel Sambuc int h2(int x) { return 1; }
13f4a2713aSLionel Sambuc 
main(void)14f4a2713aSLionel Sambuc int main(void) {
15f4a2713aSLionel Sambuc   g1<<<1, 1>>>(42);
16f4a2713aSLionel Sambuc   g1(42); // expected-error {{call to global function g1 not configured}}
17f4a2713aSLionel Sambuc   g1<<<1>>>(42); // expected-error {{too few execution configuration arguments to kernel function call}}
18f4a2713aSLionel Sambuc   g1<<<1, 1, 0, 0, 0>>>(42); // expected-error {{too many execution configuration arguments to kernel function call}}
19f4a2713aSLionel Sambuc 
20f4a2713aSLionel Sambuc   t1(1);
21f4a2713aSLionel Sambuc 
22f4a2713aSLionel Sambuc   h1<<<1, 1>>>(42); // expected-error {{kernel call to non-global function h1}}
23f4a2713aSLionel Sambuc 
24f4a2713aSLionel Sambuc   int (*fp)(int) = h2;
25f4a2713aSLionel Sambuc   fp<<<1, 1>>>(42); // expected-error {{must have void return type}}
26f4a2713aSLionel Sambuc }
27