This patch is fixing the issue reported in:
and in the bug:
Since address space conversion changes pointer representation it is not legal to do it for the nested pointers even with compatible address spaces. Because the address space conversion in the nested levels can't be generated. The behavior implemented by this patch is as follows:
- Reject any implicit conversions of nested pointers with address spaces.
- Reject address space of nested pointers conversions in safe casts e.g. const_cast or static_cast.
- Allow conversion in low level C-style or reinterpret_cast but with a warning (this aligns with OpenCL C behavior).