This is an archive of the discontinued LLVM Phabricator instance.

[libc++] ADL-proof <thread>, and eliminate `using namespace chrono`.
ClosedPublic

Authored by Quuxplusone on Nov 27 2020, 11:55 AM.

Details

Summary

Since we know exactly which identifiers we expect to find in chrono, a using-directive seems like massive overkill. Remove the directives and qualify the names as needed.

One subtle trick here: In two places I replaced *__p with *__p.get(). The former is an unqualified call to operator* on a class type, which triggers ADL and breaks the new test. The latter is a call to the built-in operator* on pointers, which specifically does not trigger ADL thanks to (over.match.oper)/1.

Diff Detail

Event Timeline

Herald added a reviewer: Restricted Project. · View Herald TranscriptNov 27 2020, 11:55 AM
Quuxplusone requested review of this revision.Nov 27 2020, 11:55 AM

Disable the new test for C++03, because it requires the perfect-forwarding constructor of std::thread which is not supported in C++03.

ldionne accepted this revision.Dec 1 2020, 2:14 PM

Thanks for the fixes!

This revision is now accepted and ready to land.Dec 1 2020, 2:14 PM