Skip to content

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

Merged
parrt merged 2 commits intoantlr:masterfrom
0xFireWolf:master
Nov 19, 2022
Merged

[C++] Fix the compiler errors reported by GCC 7#3885
parrt merged 2 commits intoantlr:masterfrom
0xFireWolf:master

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