ichesnokov removed rL LLVM as the repository for this revision.
ichesnokov updated this revision to Diff 46655.
ichesnokov added a comment.

Test cases moved to single file.
Please review and accept.


http://reviews.llvm.org/D16682

Files:
  test/SemaOpenCL/ternary-implicit-casts.cl

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 *')}}
+} 


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 *')}}
+} 
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to