]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - test/SemaOpenCL/func.cl
Vendor import of clang 3.9.1 release r289601:
[FreeBSD/FreeBSD.git] / test / SemaOpenCL / func.cl
1 // RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only
2
3 // Variadic functions
4 void vararg_f(int, ...);                    // expected-error {{invalid prototype, variadic arguments are not allowed in OpenCL}}
5 void __vararg_f(int, ...);
6 typedef void (*vararg_fptr_t)(int, ...);    // expected-error {{invalid prototype, variadic arguments are not allowed in OpenCL}}
7 int printf(__constant const char *st, ...); // expected-error {{invalid prototype, variadic arguments are not allowed in OpenCL}}
8
9 //Function pointer
10 void foo(void*);
11
12 void bar()
13 {
14   // declaring a function pointer is an error
15   void (*fptr)(int); // expected-error{{pointers to functions are not allowed}}
16
17   // taking the address of a function is an error
18   foo((void*)foo); // expected-error{{taking address of function is not allowed}}
19   foo(&foo); // expected-error{{taking address of function is not allowed}}
20
21   // initializing an array with the address of functions is an error
22   void* vptrarr[2] = {foo, &foo}; // expected-error{{taking address of function is not allowed}} expected-error{{taking address of function is not allowed}}
23
24   // just calling a function is correct
25   foo(0);
26 }