[PATCH] D96976: [analyzer] Fix reinterpret_cast handling for pointer-to-member

Deep Majumder via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Mar 4 19:23:08 PST 2021


RedDocMD added a comment.

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). 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.

The first two are trivially done. I would like to know if it is worth following the third - especially since it is a really obscure feature.
@vsavchenko, @NoQ, @steakhal what do you think should be done?


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