Skip to content

Hashtable.h will not compile with flag "-std=c++14" due to lack of class template argument deduction #585

@mrkita

Description

@mrkita

Tried this with the latest 3.27.00 version on GCC 11.4.0.

If C++14 is enforced with "-std=c++14" then eastl will not compile with the following errors:

In file included from eastl/source/hashtable.cpp:6:
EASTL/internal/hashtable.h: In member function ‘eastl::hashtable<Key, Value, Allocator, ExtractKey, Equal, H1, H2, H, RehashPolicy, bCacheHashCode, bMutableIterators, bUniqueKeys>::node_type* eastl::hashtable<Key, Value, Allocator, ExtractKey, Equal, H1, H2, H, RehashPolicy, bCacheHashCode, bMutableIterators, bUniqueKeys>::DoAllocateNodeFromKey(const key_type&)’:
EASTL/internal/hashtable.h:1759:163: error: missing template arguments before ‘{’ token
1759 | detail::allocator_construct(mAllocator, eastl::addressof(pNode->mValue), piecewise_construct, eastl::make_tuple(key), eastl::tuple{});
| ^
EASTL/internal/hashtable.h: In member function ‘eastl::hashtable<Key, Value, Allocator, ExtractKey, Equal, H1, H2, H, RehashPolicy, bCacheHashCode, bMutableIterators, bUniqueKeys>::node_type* eastl::hashtable<Key, Value, Allocator, ExtractKey, Equal, H1, H2, H, RehashPolicy, bCacheHashCode, bMutableIterators, bUniqueKeys>::DoAllocateNodeFromKey(eastl::hashtable<Key, Value, Allocator, ExtractKey, Equal, H1, H2, H, RehashPolicy, bCacheHashCode, bMutableIterators, bUniqueKeys>::key_type&&)’:
EASTL/internal/hashtable.h:1785:182: error: missing template arguments before ‘{’ token
1785 | detail::allocator_construct(mAllocator, eastl::addressof(pNode->mValue), piecewise_construct, eastl::forward_as_tuple(eastl::move(key)), eastl::tuple{});

This is due to the lack of CTAD, so the empty tuple must be declared fully with:

eastl::tuple<>{} in order to compile.

I have confirmed this on godbolt here: https://godbolt.org/z/TeGT55PG9

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions