Skip to content
Merged
Show file tree
Hide file tree
Changes from 12 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions libcxx/docs/ReleaseNotes/21.rst
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ Implemented Papers

- N4258: Cleaning-up noexcept in the Library (`Github <https://github.com/llvm/llvm-project/issues/99937>`__)
- P1361R2: Integration of chrono with text formatting (`Github <https://github.com/llvm/llvm-project/issues/100014>`__)
- P0472R3: Put std::monostate in <utility> (`Github <https://github.com/llvm/llvm-project/issues/127874>`__)

Improvements and New Features
-----------------------------
Expand Down
2 changes: 1 addition & 1 deletion libcxx/docs/Status/Cxx2cPapers.csv
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@
"`P3475R2 <https://wg21.link/P3475R2>`__","Defang and deprecate ``memory_order::consume``","2025-02 (Hagenberg)","","",""
"`P2786R13 <https://wg21.link/P2786R13>`__","Trivial Relocatability For C++26","2025-02 (Hagenberg)","","",""
"`P3137R3 <https://wg21.link/P3137R3>`__","``views::to_input``","2025-02 (Hagenberg)","","",""
"`P0472R3 <https://wg21.link/P0472R3>`__","Put ``std::monostate`` in ``<utility>``","2025-02 (Hagenberg)","","",""
"`P0472R3 <https://wg21.link/P0472R3>`__","Put ``std::monostate`` in ``<utility>``","2025-02 (Hagenberg)","|Complete|","21",""
"`P3349R1 <https://wg21.link/P3349R1>`__","Converting contiguous iterators to pointers","2025-02 (Hagenberg)","","",""
"`P3372R3 <https://wg21.link/P3372R3>`__","constexpr containers and adaptors","2025-02 (Hagenberg)","","",""
"`P3378R2 <https://wg21.link/P3378R2>`__","constexpr exception types","2025-02 (Hagenberg)","","",""
Expand Down
1 change: 1 addition & 0 deletions libcxx/include/utility
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,7 @@ template <class T>
# if _LIBCPP_STD_VER >= 17
# include <__utility/as_const.h>
# include <__utility/in_place.h>
# include <__variant/monostate.h>
# endif

# if _LIBCPP_STD_VER >= 20
Expand Down
4 changes: 4 additions & 0 deletions libcxx/test/libcxx/transitive_includes/cxx17.csv
Original file line number Diff line number Diff line change
Expand Up @@ -640,6 +640,7 @@ experimental/utility compare
experimental/utility cstddef
experimental/utility cstdint
experimental/utility cstdlib
experimental/utility cstring
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That this adds new dependencies is a bit unexpected to me. I thought that we already had std::hash in <utility>, but that we didn't makes me think we shouldn't back-port this after all.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes i think it's not that problem to support from Cxx17

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought that we already had std::hash in <utility>, but that we didn't makes me think we shouldn't back-port this after all.

Oh... libc++'s <utility> used to provide std::hash, but such extension (?) was removed by 69d5a66 (https://reviews.llvm.org/D104002).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we keep the dependencies or just support from C++26 🤔 @frederick-vs-ja @philnik777

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's only add it in C++26 for now. It's much easier to add features than to remove them.

experimental/utility initializer_list
experimental/utility iosfwd
experimental/utility limits
Expand Down Expand Up @@ -2389,6 +2390,7 @@ tuple compare
tuple cstddef
tuple cstdint
tuple cstdlib
tuple cstring
tuple exception
tuple initializer_list
tuple iosfwd
Expand All @@ -2405,6 +2407,7 @@ typeindex compare
typeindex cstddef
typeindex cstdint
typeindex cstdlib
typeindex cstring
typeindex initializer_list
typeindex iosfwd
typeindex limits
Expand Down Expand Up @@ -2501,6 +2504,7 @@ utility compare
utility cstddef
utility cstdint
utility cstdlib
utility cstring
utility initializer_list
utility iosfwd
utility limits
Expand Down
4 changes: 4 additions & 0 deletions libcxx/test/libcxx/transitive_includes/cxx20.csv
Original file line number Diff line number Diff line change
Expand Up @@ -636,6 +636,7 @@ experimental/utility compare
experimental/utility cstddef
experimental/utility cstdint
experimental/utility cstdlib
experimental/utility cstring
experimental/utility initializer_list
experimental/utility iosfwd
experimental/utility limits
Expand Down Expand Up @@ -2417,6 +2418,7 @@ tuple compare
tuple cstddef
tuple cstdint
tuple cstdlib
tuple cstring
tuple exception
tuple initializer_list
tuple iosfwd
Expand All @@ -2433,6 +2435,7 @@ typeindex compare
typeindex cstddef
typeindex cstdint
typeindex cstdlib
typeindex cstring
typeindex initializer_list
typeindex iosfwd
typeindex limits
Expand Down Expand Up @@ -2529,6 +2532,7 @@ utility compare
utility cstddef
utility cstdint
utility cstdlib
utility cstring
utility initializer_list
utility iosfwd
utility limits
Expand Down
2 changes: 2 additions & 0 deletions libcxx/test/libcxx/transitive_includes/cxx23.csv
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,7 @@ experimental/type_traits type_traits
experimental/type_traits version
experimental/utility compare
experimental/utility cstdint
experimental/utility cstring
experimental/utility initializer_list
experimental/utility limits
experimental/utility utility
Expand Down Expand Up @@ -1116,6 +1117,7 @@ unordered_set tuple
unordered_set version
utility compare
utility cstdint
utility cstring
utility initializer_list
utility limits
utility version
Expand Down
2 changes: 2 additions & 0 deletions libcxx/test/libcxx/transitive_includes/cxx26.csv
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,7 @@ experimental/type_traits type_traits
experimental/type_traits version
experimental/utility compare
experimental/utility cstdint
experimental/utility cstring
experimental/utility initializer_list
experimental/utility limits
experimental/utility utility
Expand Down Expand Up @@ -1114,6 +1115,7 @@ unordered_set tuple
unordered_set version
utility compare
utility cstdint
utility cstring
utility initializer_list
utility limits
utility version
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
//===----------------------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

// REQUIRES: std-at-least-c++17

// <utility>

// constexpr bool operator<(monostate, monostate) noexcept { return false; }
// constexpr bool operator>(monostate, monostate) noexcept { return false; }
// constexpr bool operator<=(monostate, monostate) noexcept { return true; }
// constexpr bool operator>=(monostate, monostate) noexcept { return true; }
// constexpr bool operator==(monostate, monostate) noexcept { return true; }
// constexpr bool operator!=(monostate, monostate) noexcept { return false; }
// constexpr strong_ordering operator<=>(monostate, monostate) noexcept { return strong_ordering::equal; } // since C++20

#include <cassert>
#include <utility>

#include "test_comparisons.h"
#include "test_macros.h"

constexpr bool test() {
using M = std::monostate;
constexpr M m1{};
constexpr M m2{};
assert(testComparisons(m1, m2, /*isEqual*/ true, /*isLess*/ false));
AssertComparisonsAreNoexcept<M>();

#if TEST_STD_VER > 17
assert(testOrder(m1, m2, std::strong_ordering::equal));
AssertOrderAreNoexcept<M>();
#endif // TEST_STD_VER > 17

return true;
}

int main(int, char**) {
test();
static_assert(test());

return 0;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@

//===----------------------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

// REQUIRES: std-at-least-c++17

// <utility>

// struct monostate {};

#include <type_traits>
#include <utility>

#include "test_macros.h"

int main(int, char**) {
using M = std::monostate;
static_assert(std::is_trivially_default_constructible<M>::value, "");
static_assert(std::is_trivially_copy_constructible<M>::value, "");
static_assert(std::is_trivially_copy_assignable<M>::value, "");
static_assert(std::is_trivially_destructible<M>::value, "");
constexpr M m{};
((void)m);

return 0;
}