incomplete type for std::unordered_set compiling error in g++5, compiles in clang++
问题 Consider the code related to a previous SO question C++ cyclic dependency confusion with adjacency list representation #include <cstddef> #include <unordered_set> class Node; class Hash { public: std::size_t operator()(const Node &node) const; }; class Node { public: int data; std::unordered_set<Node, Hash> links; }; inline size_t Hash::operator()(const Node &node) const { return node.data; } int main() { } This code does not compile when using g++4.9.2 or g++5, however compiles with clang++3