[all-commits] [llvm/llvm-project] 1e7a98: [libc++] Implement LWG2899: Constrain move special...

A. Jiang via All-commits all-commits at lists.llvm.org
Thu Aug 6 02:25:49 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 1e7a98d90020ea3cfef60e1c0ab85cf2b41a7cb0
      https://github.com/llvm/llvm-project/commit/1e7a98d90020ea3cfef60e1c0ab85cf2b41a7cb0
  Author: A. Jiang <de34 at live.cn>
  Date:   2026-08-06 (Thu, 06 Aug 2026)

  Changed paths:
    M libcxx/docs/Status/Cxx20Issues.csv
    M libcxx/include/__memory/unique_ptr.h
    M libcxx/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.asgn/move.pass.cpp
    M libcxx/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.asgn/move_convert.pass.cpp
    M libcxx/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.asgn/move_convert.runtime.pass.cpp
    M libcxx/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.asgn/move_convert.single.pass.cpp
    M libcxx/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.ctor/move.pass.cpp
    M libcxx/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/move.pass.cpp
    M libcxx/test/std/utilities/tuple/tuple.tuple/tuple.elem/tuple.by.type.verify.cpp
    M libcxx/test/std/utilities/utility/pairs/pair.astuple/pairs.by.type3.verify.cpp

  Log Message:
  -----------
  [libc++] Implement LWG2899: Constrain move special functions of `tuple` and `unique_ptr` (#167211)

libc++'s `tuple`'s move constructor is well-constrained when initially
implemented. So this patch only adds test cases.

For `unique_ptr`, its move constructor and move assignment operator were
previously unconstrained and thus this patch changes them. There doesn't
seem "obviously correct" approach for constraining in pre-C++20 modes,
and this patch attempts to use `__nat` trick to avoid turning the
functions into templates which are not move special functions.

Some tests case are adjusted because false positive of
move-assignability of `unique_ptr` is reduced. Comments are updated to
reflect that move-constructibility is not actually required for
`unique_ptr`'s deleter.

This patch also explicitly deletes copy functions of `unique_ptr` in all
modes. Previously, they are implicitly deleted since C++11 mode,
although the standard wording always explicitly deletes them. Clang
seems to be somehow buggy on propagating deleted-ness of special member
functions from unnamed structs, while explicit deletion can act as a
workaround.

The title of this patch is adjusted to reflect the final resolution of
LWG2899.

---------

Co-authored-by: Louis Dionne <ldionne.2 at gmail.com>



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list