Page MenuHomePhabricator

[libcxx] [test] Portability fix: change header for struct hash.
ClosedPublic

Authored by amakc11 on Nov 19 2018, 8:46 AM.

Details

Reviewers
EricWF
ldionne
Summary

The Emplaceble.h test header defines hash function for containers used during testing. For this purpose, it creates a specialization of struct hash template defined in namespace std. However, to get access to struct hash it includes wrong header <utility>. According to C++11 standard, struct hash should be defined in the following standard headers:

  1. <system_error> (section [syserr]);
  2. <bitset> (section [template.bitset]);
  3. <memory> (section [memory.syn]);
  4. <functional> (sections [function.objects], [unord.hash]);
  5. <typeindex> (section [type.index.synopsis]);
  6. <string> (section [string.classes]);
  7. <vector> (section [sequences.general]);
  8. <thread> (section [thread.thread.id]).

Header <utility> is not in this list even in the later editions of the standard. As a result, tests including Emplaceble.h test header won't compile against some conformant libraries. The choice for <functional> as a substitute is made in accordance with the recommendation to applications.

Diff Detail

Repository
rCXX libc++

Event Timeline

amakc11 created this revision.Nov 19 2018, 8:46 AM
ldionne accepted this revision.Nov 19 2018, 9:31 AM
This revision is now accepted and ready to land.Nov 19 2018, 9:31 AM
ldionne closed this revision.Nov 19 2018, 9:45 AM

Committed as r347233. Thanks.