[PATCH] D96976: [analyzer] Fix reinterpret_cast handling for pointer-to-member
Balázs Benics via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Mar 5 00:52:27 PST 2021
steakhal added a comment.
In D96976#2605313 <https://reviews.llvm.org/D96976#2605313>, @RedDocMD wrote:
> Talking on the mailing list, I got a link on reinterpret_casting for pointer-to-member: https://timsong-cpp.github.io/cppwp/n4861/expr.reinterpret.cast#10
> The gist is that this sort of cast is only valid if we cast back to the original type (that too with a caveat).
What is that caveat?
> Now currently there are three things that can be done:
>
> - Leave things the way they are - reinterpret_cast will cause an assertion to fail
> - Never analyze reinterpret_cast - this is easy, just return nullptr for PointerToMemberData
> - Properly model this - this would require possibly adding more information in PointerToMember and a significantly complex logic to handle it.
Do you have anything specific in mind about implementing the 3rd option?
Why do you think it's //significantly complex//?
Leaving assertion failures is not an option.
IMO if this feature is important to you, then you should pursue the 3rd.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D96976/new/
https://reviews.llvm.org/D96976
More information about the cfe-commits
mailing list