Replace &__rhs with _VSTD::addressof(__rhs) to guard against ADL hijacking
of operator& in operator=. Thanks to @CaseyCarter for bringing it to our
attention.
Similar issues with hijacking operator& still exist, they will be
addressed separately.
Differential D110852
[libc++] Use addressof in assignment operator. Mordante on Sep 30 2021, 10:04 AM. Authored by
Details
Replace &__rhs with _VSTD::addressof(__rhs) to guard against ADL hijacking Similar issues with hijacking operator& still exist, they will be
Diff Detail
Event Timeline
Comment Actions Thanks for the feedback. At the moment it seems the pre-merge checks are disable. So I'll fix it when the CI is in the air again.
Comment Actions LGTM % priority_queue.
Comment Actions Thanks for tackling this! LGTM but I do have a few questions.
Comment Actions Awesome, thanks for the patch. Can you rename the new tests to e.g. assign_copy.addressof.compile.pass.cpp so we can tell at a glance that it's testing some sort of addressof-related issue, or operator highjacking? |
Generally this goes after including the libc++ headers.