[all-commits] [llvm/llvm-project] 374f93: [libcxx] Fix allocator<void>::pointer in C++20 wit...

Ilya Biryukov via All-commits all-commits at lists.llvm.org
Wed Jun 15 01:56:26 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 374f938fe8f2beefbac8de9faf5d79fea8469e3d
      https://github.com/llvm/llvm-project/commit/374f938fe8f2beefbac8de9faf5d79fea8469e3d
  Author: Ilya Biryukov <ibiryukov at google.com>
  Date:   2022-06-15 (Wed, 15 Jun 2022)

  Changed paths:
    M libcxx/docs/ReleaseNotes.rst
    M libcxx/docs/UsingLibcxx.rst
    M libcxx/include/__config
    M libcxx/include/__memory/allocator.h
    A libcxx/test/libcxx/utilities/memory/default.allocator/allocator_types.void.cxx20_allocator_void_no_members.verify.cpp
    A libcxx/test/libcxx/utilities/memory/default.allocator/allocator_types.void.cxx20_with_removed_members.compile.pass.cpp

  Log Message:
  -----------
  [libcxx] Fix allocator<void>::pointer in C++20 with removed members

When compiled with `-D_LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_MEMBERS`
uses of `allocator<void>::pointer` resulted in compiler errors after D104323.
If we instantiate the primary template, `allocator<void>::reference` produces
an error 'cannot form references to void'.

To workaround this, allow to bring back the `allocator<void>` specialization by defining the new `_LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_VOID_SPECIALIZATION` macro.

To make sure the code that uses `allocator<void>` and the removed members does not break,
both `_LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_MEMBERS` and `_LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_MEMBERS` have to be defined.

Reviewed By: ldionne, #libc, philnik

Differential Revision: https://reviews.llvm.org/D126210




More information about the All-commits mailing list