C style cast in OpenCL C++ was ignoring the address space conversions from OpenCL C and as a result accepting incorrect code to compile. This commit adds correctness checking for address spaces. This makes all OpenCL C address space conversion tests from Sema passing in -cl-std=c++ mode too. Error messages have to be changed to C++ style in multiple places, but semantics of the diagnostics stay the same.
Note: this doesn't fix C++ cast operators. OpenCL C++ s3.4.4 defines special address space cast operators that align with C++'s philosophy of safe casts. The motivation behind this is that address space casts might require address translation (denoted by the addrspacecast IR instruction). In order to avoid operations modifying the type or constness together with translation of addresses, a separate cast operator is introduced. We might still have to fix the semantics of address spaces in static_cast, reinterpret_cast and const_cast but it's currently unclear to me. I will address this as a separate patch.
Why is this not a method on CastOperation?