Currently in C++ we don't set/propagate what type of implicit conversions occurs on assignments/initializations/params/etc. Therefore the diagnostic provided is more generic than in C mode. This patch attempt to propagate the conversion kind through layers of C++ semantic checks. It is currently only used for address spaces conversion of nested pointers (from https://reviews.llvm.org/D73360). Setting this for other conversions would be quite a lot of work and I am not sure I feel confident to get it right. We could potentially gradually modify it as we go along. Although this is not an actively modified code base at the moment so not sure whether it will happen and when.
Feedback welcome!
Could you hoist this up to the place where we pick the diagnostic and then make it unconditional in the path that always selects an error?
That's a general comment: we should be setting isInvalid for all the places below where we select an error diagnostic.