This is an archive of the discontinued LLVM Phabricator instance.

[C2x] Stop diagnosing member and array access in offsetof as an extension
ClosedPublic

Authored by aaron.ballman on Jan 27 2023, 7:04 AM.

Details

Reviewers
erichkeane
jyknight
Group Reviewers
Restricted Project
Summary

This was a mistake from e7300e75b51a7e7d4e81975b4be7a6c65f9a8286 (https://reviews.llvm.org/D133574) caused by us accidentally tracking an older copy of the C DR list for DR496. The text in https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2396.htm#dr_496 makes it clear that subobjects are allowed, which means member and array access expressions are allowed.

This backs out the changes from the previous commit that relate to this diagnostic.

Diff Detail

Event Timeline

aaron.ballman created this revision.Jan 27 2023, 7:04 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 27 2023, 7:04 AM
aaron.ballman requested review of this revision.Jan 27 2023, 7:04 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 27 2023, 7:04 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
erichkeane accepted this revision.Jan 27 2023, 7:07 AM
This revision is now accepted and ready to land.Jan 27 2023, 7:07 AM
jyknight accepted this revision.Jan 27 2023, 7:27 AM
aaron.ballman closed this revision.Jan 27 2023, 8:02 AM

Thanks for the quick review, I've landed this in 63d6b8be6cf2422228a1a8800d85a11be469c6e2

stilor added inline comments.Jan 27 2023, 10:00 AM
clang/docs/LanguageExtensions.rst
2389

Minor nit: maybe rename from ext2 to, say, offset_to_subobject to avoid implying it is an extension.

aaron.ballman added inline comments.Jan 30 2023, 11:57 AM
clang/docs/LanguageExtensions.rst
2389

I've made that change on trunk, but I probably won't cherry-pick it over to 16 as the example is reasonably clear enough. That said, if you feel strongly, feel free to pick it: 9367bd05913b11aaadf89c4edeced4321c65b605