invalid-kernel.cl 1.3 KB

1234567891011121314151617181920212223242526272829303132333435
  1. // RUN: %clang_cc1 -verify %s
  2. // RUN: %clang_cc1 -cl-std=CL2.0 -verify %s
  3. kernel void no_ptrptr(global int * global *i) { } // expected-error{{kernel parameter cannot be declared as a pointer to a pointer}}
  4. __kernel void no_privateptr(__private int *i) { } // expected-error {{pointer arguments to kernel functions must reside in '__global', '__constant' or '__local' address space}}
  5. __kernel void no_privatearray(__private int i[]) { } // expected-error {{pointer arguments to kernel functions must reside in '__global', '__constant' or '__local' address space}}
  6. kernel int bar() { // expected-error {{kernel must have void return type}}
  7. return 6;
  8. }
  9. kernel void main() { // expected-error {{kernel cannot be called 'main'}}
  10. }
  11. int main() { // expected-error {{function cannot be called 'main'}}
  12. return 0;
  13. }
  14. int* global x(int* x) { // expected-error {{return value cannot be qualified with address space}}
  15. return x + 1;
  16. }
  17. int* local x(int* x) { // expected-error {{return value cannot be qualified with address space}}
  18. return x + 1;
  19. }
  20. int* constant x(int* x) { // expected-error {{return value cannot be qualified with address space}}
  21. return x + 1;
  22. }
  23. __kernel void testKernel(int *ptr) { // expected-error {{pointer arguments to kernel functions must reside in '__global', '__constant' or '__local' address space}}
  24. }