Skip to content

Deprecation warnings for std::allocator<int>::is_always_equal #299

@adalisk-emikhaylov

Description

@adalisk-emikhaylov

This has showed up on our build with -Werror.

On this line:

using GetIsAlwaysEqual = typename T::is_always_equal;

We get: error: 'is_always_equal' is deprecated [-Werror,-Wdeprecated-declarations]

This could be disabled with pragmas, or switching to std::allocator_traits<T>::is_always_empty works too, that doesn't warn. In the latter case, allocator_traits could be used directly here:

using is_always_equal =
memory_internal::ExtractOrT<memory_internal::GetIsAlwaysEqual, Alloc,
typename std::is_empty<Alloc>::type>;

...and GetIsAlwaysEqual could be removed entirely.

A minimal example of the warning: https://gcc.godbolt.org/z/zdGMa49s3

This reproduces in phmap with just the following code:

#include <parallel_hashmap/phmap.h>

phmap::flat_hash_map<int, int> m;

int main() {}

When using clang++ -std=c++23.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions