I first enabled AS deduction for references that allowed to inherit the right conversion diagnostics based on qualification conversion rules implemented earlier for the pointer type.
Then in order to tests the deduction rules fully, I had to enable some extra features from OpenCL 2.0 that are also valid in C++.
A number of ICEs fired in the CodeGen due to missing addrspacecast. Not convinced the current solution is good though. May be it would be cleaner to add a separate CastKind here - CK_LValueAddressSpaceConversion? Although I am not entirely clear about the benefits yet.
Hi,
It seems this code doesn't work correctly(repro at the end). TBAA information is lost here because MakeNaturalAlignPointeeAddrLValue constructs LValue with alignment of poinee type but TBAA info is taken from pointer itself what is strange enough. As a result, for example, memcpy with wrong size is generated for copy constructors.
Repro:
As a solution the line could be replaced with the following:
To take all the information from the original pointer.
What do you think about solution?