olestrohm added inline comments.
================ Comment at: clang/lib/Sema/SemaCast.cpp:2359 - if (SrcType == DestType) { + if (SrcType == Self.Context.removeAddrSpaceQualType(DestType)) { // C++ 5.2.10p2 has a note that mentions that, subject to all other ---------------- rjmccall wrote: > I think the upshot of the conversation Richard and I just had is that there's > a bug here for all qualifiers; that is, `reinterpret_cast<const int>(5)` > should be allowed. Probably the right thing to do is to strip qualifiers > from DestType in the CastOperation constructor when the type is not a class > or an array. Richard, do you agree? This isn't strictly implied by the C++ > wording since the semantic analysis of the cast is logically prior to the > introduction of a qualifier pr-value expression. Ah, I see, I did indeed misunderstand the conversation above. I see now that with what Richard mentioned with `If a prvalue initially has the type “cv T”, where T is a cv-unqualified non-class, non-array type, the type of the expression is adjusted to T prior to any further analysis.` it makes sense to strip qualifiers for those cases. I also checked out gcc to compare to another implementation, and it does work there, so this behaviour doesn't seem unreasonable. I'll rework this to strip all qualifiers somewhere in the CastOperation constructor as you suggested then. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D102689/new/ https://reviews.llvm.org/D102689 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits