[PATCH] D54705: [libcxx] [test] Portability fix: change header for struct hash.
Andrey Maksimov via Phabricator
reviews at reviews.llvm.org
Mon Nov 19 08:48:31 PST 2018
amakc11 created this revision.
Herald added a reviewer: EricWF.
Herald added subscribers: libcxx-commits, ldionne.
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 <https://en.cppreference.com/w/cpp/utility/hash>.
@@ -10,7 +10,7 @@
#if TEST_STD_VER >= 11
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 346 bytes
Desc: not available
More information about the libcxx-commits