[PATCH] D102689: [C++4OpenCL] Allow address space conversion in reinterpret_cast
John McCall via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri May 28 10:03:43 PDT 2021
rjmccall 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
----------------
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.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D102689/new/
https://reviews.llvm.org/D102689
More information about the cfe-commits
mailing list