efriedma added a comment.

Generally, with an explicit cast, C allows any pointer cast with a reasonable 
interpretation, even if the underlying operation is suspicious.  For example, 
you can cast an "long*" to a "int*" (as in "(int*)(long*)p") without any 
complaint, even though dereferencing the result is likely undefined behavior.  
(C doesn't allow explicitly writing a reinterpret_cast, but that's basically 
the operation in question.)

Along those lines, in general, the normal C rules should allow casting `foo*` 
to `bar*` for any object types foo and bar, even if foo and bar are pointers 
with address spaces, like `__local int *` and `__global int *`.  I don't see 
anything in the OpenCL standard that would contradict this.  It looks like this 
patch changes that?

I agree we shouldn't allow implicit conversions, though...


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D58236/new/

https://reviews.llvm.org/D58236



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to