RESOLVED DUPLICATE of bug 179926 169769
std::get for tuple should be declared before struct TupleHash is defined
https://bugs.webkit.org/show_bug.cgi?id=169769
Summary std::get for tuple should be declared before struct TupleHash is defined
Yoshiaki Jitsukawa
Reported 2017-03-16 11:08:13 PDT
As TupleHash::hash() refers to std::get(std::tuple), it should be declared beforehand. Otherwise clang's two phase lookup cannot resolve the proper function.
Attachments
patch (908 bytes, patch)
2017-03-16 11:55 PDT, Yoshiaki Jitsukawa
no flags
patch (906 bytes, patch)
2017-03-16 11:58 PDT, Yoshiaki Jitsukawa
no flags
Yoshiaki Jitsukawa
Comment 1 2017-03-16 11:55:17 PDT
Yoshiaki Jitsukawa
Comment 2 2017-03-16 11:58:31 PDT
Alex Christensen
Comment 3 2017-03-16 16:38:43 PDT
Comment on attachment 304664 [details] patch What file fails to compile without this? We would ideally not add another #include to this widely-included file if we can get away with just including tuple before wtf/HashFunctions.h in the file that instantiates TupleHash
Yoshiaki Jitsukawa
Comment 4 2017-03-16 17:01:25 PDT
JSClassRef.cpp, for example. Adding #include <tuple> to it works fine. The completeness of HashFunctions.h doesn't matter?
Yoshiaki Jitsukawa
Comment 5 2017-03-17 08:05:52 PDT
#include <utility> template <typename T> auto myget(const T& t) { return std::get<0>(t); } #include <tuple> int foo() { return myget(std::tuple<int, int, int>(1, 2, 3)); } --- Here's a simplified code which causes a compilation error with clang while MSVC is ok.
Yoshiaki Jitsukawa
Comment 6 2017-05-12 00:04:06 PDT
There seems to be two factors in this issue: - <tuple> is implicitly included or not - compiler does two phase lookup or not On mac and ubuntu, <tuple> is implicitly included in HashFunctions.h. On windows, <tuple> is not included there but cl compiler doesn't do two phase lookup so webkit can build. However if we use clang-cl with "-fno-delayed-template-parsing", which enables two phase lookup, the compiler reports compilation errors of std::get(std::tuple), so there's still a problem of header inclusion. Anyways, if toolchain supports, passing "-fdelayed-template-parsing" (not "-fno-delayed-template-parsing") can be a workaround.
Don Olmstead
Comment 7 2017-11-21 16:16:16 PST
*** This bug has been marked as a duplicate of bug 179926 ***
Maciej Stachowiak
Comment 8 2020-06-01 14:53:30 PDT
Comment on attachment 304664 [details] patch Unflagging and obsoleting since this was resolved as a dupe.
Note You need to log in before you can comment on or make changes to this bug.