This is an archive of the discontinued LLVM Phabricator instance.

[libcxx] Fix unintended ADL inside ref(reference_wrapper<T>) and cref(reference_wrapper<T>)
ClosedPublic

Authored by logan-5 on Feb 8 2020, 12:41 PM.

Details

Summary

This patch qualifies calls to ref and cref inside ref(reference_wrapper<T>) and cref(reference_wrapper<T>), respectively. These previously unqualified calls could break in the presence of user functions called ref/cref inside associated namespaces: https://gcc.godbolt.org/z/8VfprT

Fixes https://bugs.llvm.org/show_bug.cgi?id=44398.

Thanks to @Quuxplusone for creating that Godbolt test case and submitting the bug.

Diff Detail

Event Timeline

logan-5 created this revision.Feb 8 2020, 12:41 PM

@logan-5: LGTM! (not that I have any power to commit it).

PR44398 also reports an ADL ref in <memory> https://gcc.godbolt.org/z/EHw3Gy which this patch does not fix, unless I'm missing something.

PR44398 also reports an ADL ref in <memory> https://gcc.godbolt.org/z/EHw3Gy which this patch does not fix, unless I'm missing something.

Yep; submitted a fix for that as a separate patch (D74289). :)

ldionne accepted this revision.Feb 20 2020, 9:19 AM

Thanks for the patch!

This revision is now accepted and ready to land.Feb 20 2020, 9:19 AM
This revision was automatically updated to reflect the committed changes.