Bug 169769 - std::get for tuple should be declared before struct TupleHash is defined
Summary: std::get for tuple should be declared before struct TupleHash is defined
Status: RESOLVED DUPLICATE of bug 179926
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Template Framework (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
Depends on:
Reported: 2017-03-16 11:08 PDT by Yoshiaki Jitsukawa
Modified: 2020-06-01 14:53 PDT (History)
8 users (show)

See Also:

patch (908 bytes, patch)
2017-03-16 11:55 PDT, Yoshiaki Jitsukawa
no flags Details | Formatted Diff | Diff
patch (906 bytes, patch)
2017-03-16 11:58 PDT, Yoshiaki Jitsukawa
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Yoshiaki Jitsukawa 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.
Comment 1 Yoshiaki Jitsukawa 2017-03-16 11:55:17 PDT
Created attachment 304663 [details]
Comment 2 Yoshiaki Jitsukawa 2017-03-16 11:58:31 PDT
Created attachment 304664 [details]
Comment 3 Alex Christensen 2017-03-16 16:38:43 PDT
Comment on attachment 304664 [details]

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
Comment 4 Yoshiaki Jitsukawa 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?
Comment 5 Yoshiaki Jitsukawa 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.
Comment 6 Yoshiaki Jitsukawa 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.
Comment 7 Don Olmstead 2017-11-21 16:16:16 PST

*** This bug has been marked as a duplicate of bug 179926 ***
Comment 8 Maciej Stachowiak 2020-06-01 14:53:30 PDT
Comment on attachment 304664 [details]

Unflagging and obsoleting since this was resolved as a dupe.