Home | History | Annotate | Download | only in SemaOpenCL
      1 // RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only
      2 
      3 void foo(void*);
      4 
      5 void bar()
      6 {
      7   // declaring a function pointer is an error
      8   void (*fptr)(int); // expected-error{{pointers to functions are not allowed}}
      9 
     10   // taking the address of a function is an error
     11   foo((void*)foo); // expected-error{{taking address of function is not allowed}}
     12   foo(&foo); // expected-error{{taking address of function is not allowed}}
     13 
     14   // initializing an array with the address of functions is an error
     15   void* vptrarr[2] = {foo, &foo}; // expected-error{{taking address of function is not allowed}} expected-error{{taking address of function is not allowed}}
     16 
     17   // just calling a function is correct
     18   foo(0);
     19 }
     20