File tree Expand file tree Collapse file tree 2 files changed +14
-0
lines changed Expand file tree Collapse file tree 2 files changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -375,6 +375,8 @@ size_t Pointer::computeOffsetForComparison() const {
375375 }
376376
377377 if (const Record *R = P.getBase ().getRecord (); R && R->isUnion ()) {
378+ if (P.isOnePastEnd ())
379+ ++Result;
378380 // Direct child of a union - all have offset 0.
379381 P = P.getBase ();
380382 continue ;
Original file line number Diff line number Diff line change @@ -966,3 +966,15 @@ namespace AddressComparison {
966966 static_assert (&U2.a[0 ] != &U2.b[1 ]);
967967 static_assert (&U2.a[0 ] == &U2.b[1 ]); // both-error {{failed}}
968968}
969+
970+ #if __cplusplus >= 202002L
971+ namespace UnionMemberOnePastEnd {
972+ constexpr bool b () {
973+ union {
974+ int p;
975+ };
976+ return &p == (&p + 1 );
977+ }
978+ static_assert (!b());
979+ }
980+ #endif
You can’t perform that action at this time.
0 commit comments