This is an archive of the discontinued LLVM Phabricator instance.

Emit offsetof values as notes when a static_assert fails
AbandonedPublic

Authored by arichardson on Aug 17 2021, 8:32 AM.

Details

Summary

Trying to debug a static_assert(offset(foo, field) == ...) failure can be
rather awkward since there is no easy way to print the value at compile
time without another compiler diagnostic involving an array size.
This builds upon the sizeof()/alignof() printing and extends it to handle
OffsetOfExpr.

Depends on D108211

Diff Detail

Event Timeline

arichardson requested review of this revision.Aug 17 2021, 8:32 AM
arichardson created this revision.
Herald added a project: Restricted Project. · View Herald TranscriptAug 17 2021, 8:32 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
arichardson abandoned this revision.Sep 22 2022, 6:43 AM

No longer needed

Herald added a project: Restricted Project. · View Herald TranscriptSep 22 2022, 6:43 AM