This is an archive of the discontinued LLVM Phabricator instance.

[clang][Interp] Reject reinterpret_casts
AbandonedPublic

Authored by tbaeder on Nov 7 2022, 8:30 AM.

Details

Summary

An appropriate diagnostic has already been emitted when we get to the expression, so just return false here.

Diff Detail

Event Timeline

tbaeder created this revision.Nov 7 2022, 8:30 AM
Herald added a project: Restricted Project. · View Herald TranscriptNov 7 2022, 8:30 AM
tbaeder requested review of this revision.Nov 7 2022, 8:30 AM
Herald added a project: Restricted Project. · View Herald TranscriptNov 7 2022, 8:30 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript

This is lacking test coverage. (Other interesting related test coverage are casts that perform a reinterpret_cast under the hood but that might be somewhat separate.)

This is lacking test coverage. (Other interesting related test coverage are casts that perform a reinterpret_cast under the hood but that might be somewhat separate.)

Well I think at least things like C-style casts that basically end up being reinterpret_cast should be tested as well e.g.:

constexpr int x = 1;
constexpr float *fp = (float*)x;
tbaeder abandoned this revision.Jun 19 2023, 10:51 PM