[PATCH] D16682: 19957 - OpenCL incorrectly accepts implicit address space conversion with ternary operator

Alexey Bader via cfe-commits cfe-commits at lists.llvm.org
Fri Feb 5 10:54:57 PST 2016


bader added a subscriber: bader.

================
Comment at: test/SemaOpenCL/ternary-implicit-casts.cl:10-11
@@ +9,4 @@
+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 *')}}
+} 
----------------
Note that test doesn't specify OpenCL version. By default it's 1.0, so ptr points to private AS and it's illegal to cast pointers from different address spaces in OpenCL v1.x.


http://reviews.llvm.org/D16682





More information about the cfe-commits mailing list