Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[C++] Fix the compiler errors reported by GCC 7 #3885

Merged
merged 2 commits into from
Nov 19, 2022
Merged

Conversation

0xFireWolf
Copy link
Contributor

@0xFireWolf 0xFireWolf commented Sep 12, 2022

Abstract:

This PR fixes the compiler errors in src/FlatHashSet.h and src/FlatHashMap.h introduced in the previous PR #3694.

Details:

template <typename Key,
          typename Hash = typename std::unordered_set<Key>::hasher,
          typename Equal = typename std::unordered_set<Key>::key_equal,
          typename Allocator = typename std::unordered_set<Key>::allocator_type>
using FlatHashSet = std::unordered_set<Key, Hash, Equal, Allocator>;

The existing type definition of FlatHashSet/Map is problematic if Key is not natively hashable (i.e. No specialization of std::hash<Key> available, so std::unordered_set<Key> cannot be specialized and therefore the member type hasher does not exist), resulting in errors when the runtime library is being compiled by GCC 7 or Clang with GCC installation path set to GCC 7. You may find the error message produced by the Conan CI pipeline at here: conan-io/conan-center-index#12902 (comment).

Since the runtime library now targets C++17 which is supported by GCC 7, it would be great to fix this incompatibility. (To be honest, I was somewhat surprised by GCC 8+ that do not treat this as an error...)

Thank you.

…er errors reported by GCC 7.

Signed-off-by: FireWolf <austere.j@gmail.com>
…er errors reported by GCC 7.

Signed-off-by: FireWolf <austere.j@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants