772 Commits

Author SHA1 Message Date
William Tran-Viet
1c51886920
[libc++] Implement P3168R2: Give optional range support (#149441)
Resolves #105430

- Implement all required pieces of P3168R2
- Leverage existing `wrap_iter` and `bounded_iter` classes to implement
the `optional` regular and hardened iterator type, respectively
- Update documentation to match
2025-08-18 18:04:45 +03:00
Hristo Hristov
f3008c1140
[libc++][flat_set] LWG3751, LWG3774 (#153934)
- LWG3751: Missing feature macro for `flat_set`

Implemented in LLVM21:
7013b51548

Closes  #105021

- LWG3774: `<flat_set>` should include `<compare>`

Implemented in LLVM21:
2f1416bbcd

684797b644/libcxx/include/flat_set (L77)

Closes #105036
2025-08-17 09:52:07 +08:00
Hristo Hristov
0561ede6c6
[libc++][jthread] LWG3788: jthread::operator=(jthread&&) postconditions are unimplementable under self-assignment (#153758)
Already implemented in LLVM18:
[695138c](695138ca84)

For details see:
https://github.com/llvm/llvm-project/issues/105045#issuecomment-3190674947

Closes #105045
2025-08-16 11:17:30 +08:00
Hristo Hristov
6d40257b05
[libc++][ranges] LWG4096: views::iota(views::iota(0)) should be rejected (#152855)
Fixes #105352
2025-08-13 19:21:13 -04:00
yronglin
24b772769f
[libc++] Implement LWG4222 'expected' constructor from a single value missing a constraint (#152676)
Implement [LWG4222](https://wg21.link/LWG4222).
Closes https://github.com/llvm/llvm-project/issues/148208

Signed-off-by: yronglin <yronglin777@gmail.com>
2025-08-10 01:11:20 +08:00
A. Jiang
4a509f853f
[libc++] Implement comparison operators for tuple added in C++23 (#148799)
And constrain the new `operator==` since C++26.

This patch implements parts of P2165R4, P2944R3, and a possibly improved
resolution of LWG3882. Currently, libstdc++ and MSVC STL constrain the
new overloads in the same way.

Also set feature-test macro `__cpp_lib_constrained_equality` and add
related release note, as P2944R3 will completed with this patch.

Fixes #136765
Fixes #136770
Fixes #105424
2025-08-01 11:53:33 -04:00
Hui
d344c383e2
[libc++][ranges] implement std::ranges::zip_transform_view (#79605)
Fixes #104977
Fixes #105035

---------

Co-authored-by: Louis Dionne <ldionne.2@gmail.com>
Co-authored-by: A. Jiang <de34@live.cn>
2025-07-20 09:13:59 +01:00
A. Jiang
3d688233bd
[libc++][docs] Add missing entry for status pages, fix bad formatting, and deduplicate (#148186)
In a previously PR, the entry for P3491R3 define_static_{string,object,array} was missing.
This patch adds it back.

The number of LWG2687, LWG2709, LWG3315, LWG3395, LWG3987, and LWG4113
were duplicated in the title. It seems better to avoid such duplicates.

Also fixes some formatting to properly use italic and code styles, and
remove one improper leading space from the title of P3682R0 (which
caused incorrect alignment in the generated page).
2025-07-15 11:14:41 -04:00
Hristo Hristov
5fc844acd8
[libc++] P2944R3: Constrained comparisons - optional (#144249)
Partially implements [P2944R3](https://wg21.link/P2944R3) which adds
constrained comparisons to std::optional.

Closes #136767


# References
[optional.relops](https://wg21.link/optional.relops)
[optional.comp.with.t](https://wg21.link/optional.comp.with.t)

---------

Co-authored-by: Hristo Hristov <zingam@outlook.com>
2025-07-15 10:12:39 +02:00
A. Jiang
4177bfdb46
[libc++][docs] Confirm that P2372R3 has been implemented (#148573)
In #125921, the changes requested by P2372R3 were completed and tested
together with corresponding `chrono` types. But that PR didn't mention
P2372R3. The `__cpp_lib_format` FTM was even bumped by an earlier PR
#98275.

This PR confirms that P2372R3 was completed in LLVM 21 (together with P1361R2).
Closes #100043
2025-07-14 10:23:27 -04:00
A. Jiang
e8a50a2568
[libc++][docs] Update paper & LWG issue lists after 2025-06 meeting (#147668)
CWG papers requiring library support are also listed.
2025-07-10 08:56:36 +08:00
Louis Dionne
a34db6f889 [libc++] Mark a few LWG issues as complete instead of Nothing To Do
A few LWG issues did require some testing changes and were not just
non-normative wording changes in the spec, so those should be
"Complete" instead of "Nothing to do".

Also mark LWG3987 and LWG4113 as complete:
- LWG3987 was done in https://github.com/llvm/llvm-project/pull/137524
- LWG4113 was done in https://github.com/llvm/llvm-project/pull/138291
2025-07-09 09:21:27 -04:00
A. Jiang
8ff636309d
[libc++][docs] Fix bad status and links in Cxx2cIssues.csv (#147669)
Currently, versions for (already implemented) LWG4024 and LWG4157 are
listed, but they are not marked "Complete" yet.
- LWG4024 was implemented together with P1020R1 + P1973R1 in 9af9d39a47d.
- LWG4157 was implemented together with P2167R3 in 557f7e1398e1.

Moreover, links for LWG issues resolved in 2025-02 Hagenberg meeting
were broken, they need to be fixed.
2025-07-09 09:20:35 -04:00
Hui
0d1e5ab2fd
[libc++] P2655R3 common_reference_t of reference_wrapper Should Be a Reference Type (#141408)
Fixes #105260

This patch applies the change as a DR to C++20. The rationale is that
the paper is more like a bug fix. It does not introduce new features, it
simply changes an existing behaviour (as a bug fix). MSVC STL DRed this
paper to C++20 as well.
2025-07-06 17:32:59 +01:00
Hristo Hristov
a19d37044b
[libc++] P2944R3: Constrained comparisions - tuple (#145677)
Implements P2944R3 partially, which adds constrained comparisons
`std::tuple`.
The missing overloads introduced in [P2165R4](https://wg21.link/P2165R4)
are not implemented.

Uses
[`__all`](f7af33a9eb/libcxx/include/__type_traits/conjunction.h (L45))
instead of a fold expression, see comment:
https://github.com/llvm/llvm-project/pull/141396#discussion_r2161166077

Relates to #136765

# References

[tuple.rel](https://wg21.link//tuple.rel)
2025-06-27 20:12:18 +03:00
Hristo Hristov
f2f4b557aa
[libc++] P2944R3: Constrained comparisions - variant (#141396)
This is a follow-up and depends on #139368 being merged first.

Implements [P2944R3](https://wg21.link/P2944R3) partially, which adds
constrained comparisons to `std::variant`

Closes #136769

Depends on #139368

# References

[variant.relops](https://wg21.link/variant.relops)
2025-06-25 12:12:23 +03:00
Hui
831fcb5e91
[libc++] constexpr flat_map (#137453)
Fixes #128673
2025-06-21 13:41:32 +01:00
Jakub Mazurkiewicz
1bb2328fd3
[libc++] Implement views::join_with (#65536)
* Implement "P2441R2 `views::join_with`" (https://wg21.link/P2441R2),
closes #105185
* Implement LWG4074 (https://wg21.link/LWG4074), closes #105346
* Complete implementation of "P2711R1 Making multi-param constructors of
views explicit" (https://wg21.link/P2711R1), closes #105252
* Complete implementation of "P2770R0 Stashing stashing iterators for
proper flattening" (https://wg21.link/P2770R0), closes #105250
2025-06-21 10:54:50 +01:00
Hristo Hristov
a0c00ccd5f
[libc++] P2944R3: Constrained comparisons - update reference_wrapper implementation (#139368)
Updates the implementation `std::reference_wrapper` -
[P2944R3](https://wg21.link/P2944R3) as discussed in
https://github.com/llvm/llvm-project/pull/117664#discussion_r1857826166
This PR also refactors the tests in preparation to implements the
constrained comparisons for `optional`, `variant` etc.

- Moves the test helpers (concepts and types) for testing constrained
comparisons to `test_comparisons.h`.
- Updates the `std::reference_wrapper` implementation to use the concept
`__core_convertible_to<bool>` as per comments in #135759.

Closes #138233

# References:
- [refwrap.comparisons](https://wg21.link/refwrap.comparisons)

---------

Co-authored-by: Hristo Hristov <zingam@outlook.com>
Co-authored-by: Nikolas Klauser <nikolasklauser@berlin.de>
2025-06-15 07:45:48 +03:00
Peng Liu
ec5610c4a2
[libc++] Ensure strong exception guarantee for forward_list::resize (#131025)
The current implementation of `forward_list::resize` does not meet the
strong exception safety guarantee required by [forward.list.modifiers]:

    If an exception is thrown by any of these member functions there is no
    effect on the container.

This patch refactors `resize()` to provide strong exception safety and
introduces additional tests to validate the strong exception guarantees
for other `forward_list` modifiers.

Fixes #118366.
2025-06-04 13:04:19 -04:00
yronglin
13c464be84
[libc++] Implement P3379R0 Constrain std::expected equality operators (#135759)
Closes #118135

Co-authored-by: A. Jiang <de34@live.cn>
2025-05-07 15:25:00 -04:00
A. Jiang
fc281e1b4f
[libc++][docs] Confirm that P3136R1 Retiring niebloids is Complete (#135932)
As libc++ has been implementing niebloids as CPOs since LLVM 14 due to
https://reviews.llvm.org/D116570.

Also changes some comments in test files to use the formal term
"algorithm function object".

Closes #118133.
2025-05-07 15:20:43 -04:00
Hristo Hristov
4ed8f38e81
[libc++][pair] P2944R3: Constrain std::pair's equality operator (#136672)
Implements https://wg21.link/P2944R3 (partially):
- [pairs.spec](https://eel.is/c++draft/pairs.spec)

Related issues:
- Related to #105424
- Related to #118135
  - PR https://github.com/llvm/llvm-project/pull/135759
  - PR https://github.com/llvm/llvm-project/pull/117664

Closes: [#136763](https://github.com/llvm/llvm-project/issues/136763)

# References
- https://eel.is/c++draft/concept.booleantestable
- https://eel.is/c++draft/concept.equalitycomparable

---------

Co-authored-by: Hristo Hristov <zingam@outlook.com>
Co-authored-by: Nikolas Klauser <nikolasklauser@berlin.de>
2025-04-29 22:00:16 +03:00
Damien L-G
557e931d95
[libc++] Implement P2897R7 aligned_accessor: An mdspan accessor expressing pointer over-alignment (#122603)
Closes #118372
2025-04-14 17:33:57 -04:00
A. Jiang
ab95005a05
[libc++] P3247R2: Deprecate is_trivial(_v) (#130573)
Requirements on character-like types are updated unconditionally,
because `basic_string` does requires the default-constructibility. It
might be possible to make `basic_string_view` support classes with
non-public trivial default constructor, but this doesn't seem sensible.

libcxxabi's `ItaniumDemangle.h` is also updated to avoid deprecated
features.
2025-04-09 07:40:01 +08:00
Hui
7013b51548
[libc++] Implement std::flat_multiset (#128363)
fixes https://github.com/llvm/llvm-project/issues/105193
2025-04-06 10:50:55 +01:00
James E T Smith
475cbf0ad6
[libc++] Implement ranges::iota (#68494)
# Overview

As a disclaimer, this is my first PR to LLVM and while I've tried to
ensure I've followed the LLVM and libc++ contributing guidelines,
there's probably a good chance I missed something. If I have, just let
me know and I'll try to correct it as soon as I can.

This PR implements `std::ranges::iota` and
`std::ranges::out_value_result` outlined in
[P2440r1](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2021/p2440r1.html).

As outlined in the paper above, I've:
- Implemented `out_value_result` and added to `<algorithm>`
- Added `out_value_result`, `iota_result`, and two overloads of `iota`
to `std::ranges` in `<numeric>`
- Updated the version macro `__cpp_lib_ranges_iota` in `<version>`

I've also added tests for `ranges::iota` and `ranges::out_value_result`.
Lastly, I added those structs to the appropriate module files.

Partially implements #105184

EDIT: Forgot to mention in the original post, thanks to @hawkinsw for
taking a look at a preliminary version of this PR!

# TODOs
- [x] Updating the range [status
doc](https://github.com/jamesETsmith/llvm-project/blob/main/libcxx/docs/Status/RangesMajorFeatures.csv)
- [x] Ensure all comments from https://reviews.llvm.org/D121436 are
addressed here
- [X] EDIT (I'll do this in a separate PR). ~~I'm open to implementing
the rest of P2440r1 (`ranges::shift_left` and `ranges::shift_right`) if
that's ok, I just wanted to get feedback on `ranges::iota` first~~
- [x] I've been having trouble building the modules locally and want to
make sure that's working properly

Closes: #134060
2025-04-05 13:46:11 +02:00
Mark de Wever
f9aa7a20d9
[libc++] Verify std::forward_like's mandates clause. (#127318)
The existing using _ForwardLike declaration already fails with a
subsitution failure. The LWG issue was filed to clarify what should
happen for non-referencable types.

Added test to verify libc++ is already enforcing the new Mandates.

Implements:
- LWG3757 What's the effect of std::forward_like<void>(x)

Closes: #105026
2025-03-26 20:53:30 -04:00
Peng Xie
3fbd0ec7e3
[libc++] Update the status for LWG3120 (#116772)
The current implementation already have an __initial_descriptor which
saves the initial state. When release() is called, we will reset the
__initial_descriptor.__cur_ pointer.

This patch also updates the status of LWG3120.

Closes #104274

---------

Co-authored-by: Louis Dionne <ldionne.2@gmail.com>
2025-03-25 20:24:56 -04:00
A. Jiang
af267993a7
[libc++] Re-implement LWG2770 again * 2 (#132598)
1013fe3c0cfd7582e94ef2d4bfd79da7ea1a1289 used to implement LWG2770, but
cb0d4df97490ec2d2b1cdf7574d26b1bc4063599 made LWG2770 unimplemented
again because of CWG2386.

This patch re-implements LWG2770, while keeping the libc++-specific
implementation strategy (which is controversial as noted in LWG4040).

Drive-by:
- Make the test coverage for the controversial part noted in LWG4040
libc++-only.
- Add the previously missed entry for LWG2770 to the documentation.
2025-03-26 07:38:02 +08:00
Amr Hesham
357306572d
[libcxx] Put std::monostate in <utility> (#128373)
Fixes: #127874
2025-03-25 18:31:57 +01:00
Hui
2f1416bbcd
[libc++] implement std::flat_set (#125241)
Co-authored-by: Louis Dionne <ldionne.2@gmail.com>
2025-03-23 14:45:21 +00:00
A. Jiang
6038077dde
[libc++] Bump __cpp_lib_constexpr_algorithms for P2562R1 in C++26 (#132075)
Completes P2562R1.
2025-03-21 07:33:52 +08:00
Peng Liu
b350bc2c0b
[libc++] Verify forward_list self-merging is a no-op (#129985)
https://wg21.link/LWG3088 requires that `forward_list::merge()` is a no-op when passed
`*this`, which aligns with the behavior of `list::merge`. Although libc++'s implementation
of `forward_list::merge()` already meets this requirement, there were no tests to verify
this behavior. This patch adds the necessary tests to ensure that self-merging remains a
no-op and prevents any future regressions on this.

Closes #104942.
2025-03-19 12:28:11 -04:00
A. Jiang
83936f5437
[libc++][docs] Remove mis-added entry for P2513R4 (#130581)
P2513R4 neither touched library wording nor required library
implementation to change. So it was probably a mistake to list it in
libc++'s implementation status table.
2025-03-10 22:58:56 +08:00
Hristo Hristov
6d9dfd75e4
[libc++][type_traits] Implements "A type trait to detect reference binding to temporary" (#128649)
Implements partially: [P2255R2: A type trait to detect reference binding
to temporary](https://wg21.link/P2255R2)
Issue: https://github.com/llvm/llvm-project/issues/105180

https://eel.is/c++draft/meta.type.synop
https://eel.is/c++draft/meta.unary.prop

Implented type traits:
- [x] `reference_constructs_from_temporary`
- [x] `reference_converts_from_temporary`

Closes #129049

Minor drive-by tweak to `std::is_implicit_lifetime` tests.

---------

Co-authored-by: Hristo Hristov <zingam@outlook.com>
2025-03-08 15:20:56 +01:00
A. Jiang
94714fb303
[libc++] Deprecate is_pod(_v) since C++20 (#129471)
Previously, commit 042f07eed8c1acba19ea04310137bee12b18045a claimed that
P0767R1 was implemented in LLVM 7.0, but no deprecation warning was
implemented. This patch adds the missing warnings.
2025-03-07 16:02:57 +08:00
A. Jiang
27e686c788
[libc++] Verify that LWG4140 is implemented (#128624)
According to the commit history, the constructors removed by LWG4140
have never been added to libc++.

Existence of non-public or deleted default constructor is observable,
this patch tests that there's no such default constructor at all.
2025-03-06 11:12:17 +08:00
A. Jiang
f5f5286da3
[libc++] Implement LWG3990 for Clang (#128834)
This patch adds `[[_Clang::__no_specializations__]]` to `tuple`, with
warning/error suppressed for `tuple<>`.
2025-03-02 23:00:08 +08:00
Mark de Wever
d2b09e21bc
[libc++] Prohibits initializer_list specializations. (#128042)
This relies on Clang's no_specializations attribute which is not
supported by GCC.

Implements:
- LWG2129: User specializations of std::initializer_list

Fixes: #126270
2025-03-01 12:34:35 +01:00
Mark de Wever
65f105b6cf
[libc++] Implements LWG3600 Making istream_iterator copy constructor trivial is an ABI break (#127343)
Closes: #105003
2025-03-01 12:29:21 +01:00
elhewaty
2c36411ed2
[libcxx] Add LWG4135: The helper lambda of std::erase for list should specify return type as bool (#128358)
Fixes https://github.com/llvm/llvm-project/issues/118355
2025-02-26 22:13:27 +02:00
Mark de Wever
26be07b851
[libc++][format] Disables narrow string to wide string formatters. (#128355)
Implements LWG3944: Formatters converting sequences of char to sequences
of wchar_t

Fixes: #105342
2025-02-26 17:54:18 +01:00
Mark de Wever
d7b3606f7f
[libc++] Updates ostream's println LWG status. (#128214)
std::println was originally implemented with support for LWG4088 by
mistake (in 2fd4084fca0c).
The tests already validate the behaviour required by LWG4088.

Fixes: #118348
2025-02-26 17:52:23 +01:00
Mark de Wever
cf50936b23
[libc++][chrono] implements GPS clock. (#125921)
Completes:
- LWG3359 <chrono> leap second support should allow for negative leap
seconds
- P1361R2 Integration of chrono with text formatting

Implements parts of:
- P0355 Extending <chrono> to Calendars and Time Zones

Fixes: #100432
Fixes: #100014
2025-02-21 17:50:01 +01:00
A. Jiang
2207e3e325
[libc++] Set feature-test macro __cpp_lib_atomic_float (#127559)
The corresponding feature was implemented in LLVM 18 (by #67799), but
this FTM wasn't added before.
2025-02-19 09:06:51 +08:00
Louis Dionne
3a00c428d9
[libc++] Add Hagenberg issues and papers to the Status pages (#127510)
Corresponding Github issues will be created shortly.
2025-02-18 15:09:39 -05:00
Louis Dionne
3fa85c7cce
[libc++] Document that libc++ does not and will never implement the Networking TS (#127508)
There has been discussion around this a few times already, and there
seemed to be consensus that we would never pursue an implementation of
the Networking TS. This patch solidifies that discussion by documenting
it and closing issues related to the Networking TS.

Closes #103799
Closes #100223
Closes #100228
Closes #100231
Closes #100232
2025-02-17 14:51:47 -05:00
Louis Dionne
ec54403522 [libc++] Synchronize a few remaining status page rows with Github issues 2025-02-17 10:26:10 -05:00
Louis Dionne
fb29f19fdb [libc++] Synchronize status pages with Github issues list 2025-02-17 10:16:56 -05:00