This is an archive of the discontinued LLVM Phabricator instance.

[libc++] Undeprecate the std::allocator<void> specialization
ClosedPublic

Authored by ldionne on Jun 15 2021, 2:30 PM.

Details

Reviewers
None
Group Reviewers
Restricted Project
Commits
rG87784cc6fb34: [libc++] Undeprecate the std::allocator<void> specialization
Summary

While the std::allocator<void> specialization was deprecated by
https://wg21.link/p0174#2.2, the *use* of std::allocator<void> by users
was not. The intent was that std::allocator<void> could still be used
in C++17 and C++20, but starting with C++20 (with the removal of the
specialization), std::allocator<void> would use the primary template.
That intent was called out in wg21.link/p0619r4#3.9.

As a result of this patch, _LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_MEMBERS
will also not control whether the explicit specialization is provided or
not. It shouldn't matter, since in C++20, one can simply use the primary
template.

Fixes http://llvm.org/PR50299

Diff Detail

Event Timeline

ldionne requested review of this revision.Jun 15 2021, 2:30 PM
ldionne created this revision.
Herald added a project: Restricted Project. · View Herald TranscriptJun 15 2021, 2:30 PM
Herald added a reviewer: Restricted Project. · View Herald Transcript
ldionne updated this revision to Diff 352308.Jun 15 2021, 5:59 PM

Fix CI failures

This revision was not accepted when it landed; it landed in state Needs Review.Jun 16 2021, 6:54 AM
This revision was automatically updated to reflect the committed changes.
halyavin added inline comments.
libcxx/include/__memory/allocator.h
31

We use _LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_MEMBERS and this change breaks code that uses allocator<void> since _LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp& reference; in the primary template doesn't compile: error: cannot form a reference to 'void'.

libcxx/test/std/utilities/memory/default.allocator/allocator_types.void.compile.pass.cpp