1// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only 2 3// Variadic functions 4void vararg_f(int, ...); // expected-error {{invalid prototype, variadic arguments are not allowed in OpenCL}} 5void __vararg_f(int, ...); 6typedef void (*vararg_fptr_t)(int, ...); // expected-error {{invalid prototype, variadic arguments are not allowed in OpenCL}} 7int printf(__constant const char *st, ...); // expected-error {{invalid prototype, variadic arguments are not allowed in OpenCL}} 8 9//Function pointer 10void foo(void*); 11 12void 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} 27