1// RUN: %clang_cc1 -verify %s 2// RUN: %clang_cc1 -cl-std=CL2.0 -DCL20 -verify %s 3 4#define NULL ((void*)0) 5 6void foo(){ 7 8global int* ptr1 = NULL; 9 10global int* ptr2 = (global void*)0; 11 12constant int* ptr3 = NULL; 13 14constant int* ptr4 = (global void*)0; // expected-error{{initializing '__constant int *' with an expression of type '__global void *' changes address space of pointer}} 15 16#ifdef CL20 17// Accept explicitly pointer to generic address space in OpenCL v2.0. 18global int* ptr5 = (generic void*)0; 19#endif 20 21global int* ptr6 = (local void*)0; // expected-error{{initializing '__global int *' with an expression of type '__local void *' changes address space of pointer}} 22 23bool cmp = ptr1 == NULL; 24 25cmp = ptr1 == (local void*)0; // expected-error{{comparison between ('__global int *' and '__local void *') which are pointers to non-overlapping address spaces}} 26 27cmp = ptr3 == NULL; 28 29} 30