Index: test/SemaOpenCL/ternary-implicit-casts.cl =================================================================== --- test/SemaOpenCL/ternary-implicit-casts.cl +++ test/SemaOpenCL/ternary-implicit-casts.cl @@ -0,0 +1,12 @@ +// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only + +kernel void implicit_cast_local(global int* gint, local int* lint, int cond) +{ + // will not compile, ptr is not generic but local + local int *ptr = cond ? gint : lint; // expected-warning {{pointer type mismatch ('__global int *' and '__local int *')}} expected-error {{initializing '__local int *' with an expression of type 'void *' changes address space of pointer}} +} + +kernel void implicit_cast_generic(global int* gint, local int* lint, int cond) { + // will compile, ptr is generic and can accept global and local + int* ptr = cond ? gint : lint; // expected-warning {{pointer type mismatch ('__global int *' and '__local int *')}} +}