Skip to content

<xmemory>: allocator::is_always_equal is incorrectly removed together with members removed in C++20 #2422

@frederick-vs-ja

Description

@frederick-vs-ja

Describe the bug
std::allocator<T>::is_always_equal is merely deprecated, but not removed via LWG-3170. MSVC STL incorrectly removes it together with members of std::allocator that are deprecated in C++17 and removed in C++20 (in #1585).

Command-line test case

C:\Temp>type repro.cpp
#include <memory>

int main()
{
    static_assert(std::allocator<int>::is_always_equal::value, "");
}

C:\Temp>cl /EHsc /W4 /std:c++latest .\repro.cpp
用于 x64 的 Microsoft (R) C/C++ 优化编译器 19.29.30138 版
版权所有(C) Microsoft Corporation。保留所有权利。

/std:c++latest 作为最新的 C++
working 草稿中的语言功能预览提供。我们希望你提供有关 bug 和改进建议的反馈。
但是,请注意,这些功能按原样提供,没有支持,并且会随着工作草稿的变化
而更改或移除。有关详细信息,请参阅
https://go.microsoft.com/fwlink/?linkid=2045807。

repro.cpp
.\repro.cpp(5): error C3083: “is_always_equal”:“::”左侧的符号必须是一种类型
.\repro.cpp(5): error C2039: "value": 不是 "std::allocator<int>" 的成员
E:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include\xmemory(905): note: 参见“std::allocator<int>”的声明
.\repro.cpp(5): error C2065: “value”: 未声明的标识符

Expected behavior
This program compiles.

STL version
Microsoft Visual Studio Community 2019
Version 16.11.8

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingfixedSomething works now, yay!

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions