[libcxx-commits] [libcxx] [libc++] P3798R1: The unexpected in std::expected (PR #204826)
Alex Kremer via libcxx-commits
libcxx-commits at lists.llvm.org
Mon Jun 22 03:58:35 PDT 2026
https://github.com/godexsoft updated https://github.com/llvm/llvm-project/pull/204826
>From ba10238d9b8a57b9e3b8459021e8c0d5b3f5f0be Mon Sep 17 00:00:00 2001
From: Alex Kremer <akremer at ripple.com>
Date: Fri, 19 Jun 2026 14:38:21 +0100
Subject: [PATCH 1/6] Add basics for has_error
---
libcxx/include/__expected/expected.h | 4 ++
.../observers/has_error.pass.cpp | 57 +++++++++++++++++++
.../generate_feature_test_macro_components.py | 2 +-
3 files changed, 62 insertions(+), 1 deletion(-)
create mode 100644 libcxx/test/std/utilities/expected/expected.expected/observers/has_error.pass.cpp
diff --git a/libcxx/include/__expected/expected.h b/libcxx/include/__expected/expected.h
index 32ed81a392702..5b8d0cfc83923 100644
--- a/libcxx/include/__expected/expected.h
+++ b/libcxx/include/__expected/expected.h
@@ -825,6 +825,10 @@ class expected : private __expected_base<_Tp, _Err> {
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool has_value() const noexcept { return this->__has_val(); }
+# if _LIBCPP_STD_VER >= 29
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool has_error() const noexcept { return !this->has_value(); }
+# endif
+
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr const _Tp& value() const& {
static_assert(is_copy_constructible_v<_Err>, "error_type has to be copy constructible");
if (!this->__has_val()) {
diff --git a/libcxx/test/std/utilities/expected/expected.expected/observers/has_error.pass.cpp b/libcxx/test/std/utilities/expected/expected.expected/observers/has_error.pass.cpp
new file mode 100644
index 0000000000000..99607e9fc7a3f
--- /dev/null
+++ b/libcxx/test/std/utilities/expected/expected.expected/observers/has_error.pass.cpp
@@ -0,0 +1,57 @@
+//===----------------------------------------------------------------------===//
+//
+// 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++29
+
+// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20, c++23, c++26
+
+// constexpr bool has_error() const noexcept;
+
+#include <cassert>
+#include <concepts>
+#include <expected>
+#include <type_traits>
+#include <utility>
+
+#include "test_macros.h"
+#include "../../types.h"
+
+// Test noexcept
+template <class T>
+concept HasErrorNoexcept =
+ requires(T t) {
+ { t.has_error() } noexcept;
+ };
+
+struct Foo {};
+static_assert(!HasErrorNoexcept<Foo>);
+
+static_assert(HasErrorNoexcept<std::expected<int, int>>);
+static_assert(HasErrorNoexcept<const std::expected<int, int>>);
+
+constexpr bool test() {
+ // has_error
+ {
+ const std::expected<int, int> e(std::unexpect, 5);
+ assert(e.has_error());
+ }
+
+ // !has_error
+ {
+ const std::expected<int, int> e(5);
+ assert(!e.has_error());
+ }
+
+ return true;
+}
+
+int main(int, char**) {
+ test();
+ static_assert(test());
+ return 0;
+}
diff --git a/libcxx/utils/generate_feature_test_macro_components.py b/libcxx/utils/generate_feature_test_macro_components.py
index d764a1f677ba6..b8cc9113e8fb0 100644
--- a/libcxx/utils/generate_feature_test_macro_components.py
+++ b/libcxx/utils/generate_feature_test_macro_components.py
@@ -557,7 +557,7 @@ def add_version_header(tc):
},
{
"name": "__cpp_lib_expected",
- "values": {"c++23": 202211},
+ "values": {"c++23": 202211, "c++29": 202606},
"headers": ["expected"],
},
{
>From 21e19485738bf5f295c785fe92832de90e1ae321 Mon Sep 17 00:00:00 2001
From: Alex Kremer <akremer at ripple.com>
Date: Fri, 19 Jun 2026 16:03:27 +0100
Subject: [PATCH 2/6] Use preferred REQUIRES syntax
---
.../expected/expected.expected/observers/has_error.pass.cpp | 2 --
1 file changed, 2 deletions(-)
diff --git a/libcxx/test/std/utilities/expected/expected.expected/observers/has_error.pass.cpp b/libcxx/test/std/utilities/expected/expected.expected/observers/has_error.pass.cpp
index 99607e9fc7a3f..a9c967b9331aa 100644
--- a/libcxx/test/std/utilities/expected/expected.expected/observers/has_error.pass.cpp
+++ b/libcxx/test/std/utilities/expected/expected.expected/observers/has_error.pass.cpp
@@ -8,8 +8,6 @@
// REQUIRES: std-at-least-c++29
-// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20, c++23, c++26
-
// constexpr bool has_error() const noexcept;
#include <cassert>
>From 8b3c605419b939199d5407ef2d51559424836573 Mon Sep 17 00:00:00 2001
From: Alex Kremer <akremer at ripple.com>
Date: Mon, 22 Jun 2026 00:33:21 +0100
Subject: [PATCH 3/6] Implement for void and review suggestions
---
libcxx/include/__expected/expected.h | 4 ++
.../observers/has_error.pass.cpp | 26 ++++------
.../observers/has_error.pass.cpp | 51 +++++++++++++++++++
3 files changed, 66 insertions(+), 15 deletions(-)
create mode 100644 libcxx/test/std/utilities/expected/expected.void/observers/has_error.pass.cpp
diff --git a/libcxx/include/__expected/expected.h b/libcxx/include/__expected/expected.h
index 5b8d0cfc83923..360e9c4a8df6a 100644
--- a/libcxx/include/__expected/expected.h
+++ b/libcxx/include/__expected/expected.h
@@ -1603,6 +1603,10 @@ class expected<_Tp, _Err> : private __expected_void_base<_Err> {
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool has_value() const noexcept { return this->__has_val(); }
+# if _LIBCPP_STD_VER >= 29
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool has_error() const noexcept { return !this->has_value(); }
+# endif
+
_LIBCPP_HIDE_FROM_ABI constexpr void operator*() const noexcept {
_LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
this->__has_val(), "expected::operator* requires the expected to contain a value");
diff --git a/libcxx/test/std/utilities/expected/expected.expected/observers/has_error.pass.cpp b/libcxx/test/std/utilities/expected/expected.expected/observers/has_error.pass.cpp
index a9c967b9331aa..80591aec36532 100644
--- a/libcxx/test/std/utilities/expected/expected.expected/observers/has_error.pass.cpp
+++ b/libcxx/test/std/utilities/expected/expected.expected/observers/has_error.pass.cpp
@@ -16,30 +16,16 @@
#include <type_traits>
#include <utility>
-#include "test_macros.h"
#include "../../types.h"
-// Test noexcept
-template <class T>
-concept HasErrorNoexcept =
- requires(T t) {
- { t.has_error() } noexcept;
- };
-
-struct Foo {};
-static_assert(!HasErrorNoexcept<Foo>);
-
-static_assert(HasErrorNoexcept<std::expected<int, int>>);
-static_assert(HasErrorNoexcept<const std::expected<int, int>>);
+static_assert(noexcept(std::expected<int, int>().has_error()));
constexpr bool test() {
- // has_error
{
const std::expected<int, int> e(std::unexpect, 5);
assert(e.has_error());
}
- // !has_error
{
const std::expected<int, int> e(5);
assert(!e.has_error());
@@ -48,8 +34,18 @@ constexpr bool test() {
return true;
}
+constexpr bool test_nodiscard() {
+ std::expected<int, int> e;
+ e.has_error(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+
+ return true;
+}
+
int main(int, char**) {
test();
static_assert(test());
+ test_nodiscard();
+ static_assert(test_nodiscard());
+
return 0;
}
diff --git a/libcxx/test/std/utilities/expected/expected.void/observers/has_error.pass.cpp b/libcxx/test/std/utilities/expected/expected.void/observers/has_error.pass.cpp
new file mode 100644
index 0000000000000..fdab2c39af6ee
--- /dev/null
+++ b/libcxx/test/std/utilities/expected/expected.void/observers/has_error.pass.cpp
@@ -0,0 +1,51 @@
+//===----------------------------------------------------------------------===//
+//
+// 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++29
+
+// constexpr bool has_error() const noexcept;
+
+#include <cassert>
+#include <concepts>
+#include <expected>
+#include <type_traits>
+#include <utility>
+
+#include "../../types.h"
+
+static_assert(noexcept(std::expected<void, int>().has_error()));
+
+constexpr bool test() {
+ {
+ const std::expected<void, int> e(std::unexpect, 5);
+ assert(e.has_error());
+ }
+
+ {
+ const std::expected<void, int> e;
+ assert(!e.has_error());
+ }
+
+ return true;
+}
+
+constexpr bool test_nodiscard() {
+ std::expected<void, int> e;
+ e.has_error(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+
+ return true;
+}
+
+int main(int, char**) {
+ test();
+ static_assert(test());
+ test_nodiscard();
+ static_assert(test_nodiscard());
+
+ return 0;
+}
>From 8c2446a7ba7173e486bf22c4195c627a19a999da Mon Sep 17 00:00:00 2001
From: Alex Kremer <akremer at ripple.com>
Date: Mon, 22 Jun 2026 11:06:19 +0100
Subject: [PATCH 4/6] Apply review suggestions
---
libcxx/docs/ReleaseNotes/23.rst | 3 ++-
libcxx/docs/Status/Cxx29Papers.csv | 2 +-
libcxx/include/__expected/expected.h | 4 ----
.../utilities/expected/nodiscard.verify.cpp | 2 ++
.../observers/has_error.pass.cpp | 17 ++++-------------
.../expected.void/observers/has_error.pass.cpp | 17 ++++-------------
.../generate_feature_test_macro_components.py | 2 +-
7 files changed, 14 insertions(+), 33 deletions(-)
diff --git a/libcxx/docs/ReleaseNotes/23.rst b/libcxx/docs/ReleaseNotes/23.rst
index e7eb42207db42..a693be565b544 100644
--- a/libcxx/docs/ReleaseNotes/23.rst
+++ b/libcxx/docs/ReleaseNotes/23.rst
@@ -52,7 +52,8 @@ Implemented Papers
- P3383R3: ``mdspan.at()`` (`Github <https://llvm.org/PR175213>`__)
- P3369R0: constexpr for ``uninitialized_default_construct`` (`Github <https://llvm.org/PR118380>`__)
- P3508R0: Wording for "constexpr for specialized memory algorithms" (`Github <https://llvm.org/PR118379>`__)
-
+- P3798R1: The unexpected in ``std::expected`` (`Github <https://llvm.org/PR204394>`__)
+
Improvements and New Features
-----------------------------
diff --git a/libcxx/docs/Status/Cxx29Papers.csv b/libcxx/docs/Status/Cxx29Papers.csv
index a5d896f260657..755eeaf7ad1fe 100644
--- a/libcxx/docs/Status/Cxx29Papers.csv
+++ b/libcxx/docs/Status/Cxx29Papers.csv
@@ -3,7 +3,7 @@
"`P4101R1 <https://wg21.link/P4101R1>`__","Consteval-only Values for C++26","2026-06 (Brno)","","","`#204391 <https://github.com/llvm/llvm-project/issues/204391>`__","Voted as a Defect Report."
"`P2414R12 <https://wg21.link/P2414R12>`__","Pointer lifetime-end zap proposed solutions","2026-06 (Brno)","","","`#204392 <https://github.com/llvm/llvm-project/issues/204392>`__","Voted as a Defect Report."
"`P3319R6 <https://wg21.link/P3319R6>`__","Add an ``iota`` object for ``simd`` (and more)","2026-06 (Brno)","","","`#204393 <https://github.com/llvm/llvm-project/issues/204393>`__",""
-"`P3798R1 <https://wg21.link/P3798R1>`__","The unexpected in ``std::expected``","2026-06 (Brno)","","","`#204394 <https://github.com/llvm/llvm-project/issues/204394>`__",""
+"`P3798R1 <https://wg21.link/P3798R1>`__","The unexpected in ``std::expected``","2026-06 (Brno)","|Complete|","23","`#204394 <https://github.com/llvm/llvm-project/issues/204394>`__","Applied as a Defect Report."
"`P3052R2 <https://wg21.link/P3052R2>`__","``view_interface::at()``","2026-06 (Brno)","","","`#204395 <https://github.com/llvm/llvm-project/issues/204395>`__",""
"`P4206R0 <https://wg21.link/P4206R0>`__","Revert string support in ``std::constant_wrapper``","2026-06 (Brno)","","","`#203336 <https://github.com/llvm/llvm-project/issues/203336>`__","To be applied as a Defect Report."
"`P3395R6 <https://wg21.link/P3395R6>`__","Fix encoding issues and add a formatter for ``std::error_code``","2026-06 (Brno)","","","`#204396 <https://github.com/llvm/llvm-project/issues/204396>`__",""
diff --git a/libcxx/include/__expected/expected.h b/libcxx/include/__expected/expected.h
index 360e9c4a8df6a..10b03f061f6e0 100644
--- a/libcxx/include/__expected/expected.h
+++ b/libcxx/include/__expected/expected.h
@@ -825,9 +825,7 @@ class expected : private __expected_base<_Tp, _Err> {
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool has_value() const noexcept { return this->__has_val(); }
-# if _LIBCPP_STD_VER >= 29
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool has_error() const noexcept { return !this->has_value(); }
-# endif
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr const _Tp& value() const& {
static_assert(is_copy_constructible_v<_Err>, "error_type has to be copy constructible");
@@ -1603,9 +1601,7 @@ class expected<_Tp, _Err> : private __expected_void_base<_Err> {
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool has_value() const noexcept { return this->__has_val(); }
-# if _LIBCPP_STD_VER >= 29
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool has_error() const noexcept { return !this->has_value(); }
-# endif
_LIBCPP_HIDE_FROM_ABI constexpr void operator*() const noexcept {
_LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
diff --git a/libcxx/test/libcxx/utilities/expected/nodiscard.verify.cpp b/libcxx/test/libcxx/utilities/expected/nodiscard.verify.cpp
index c9af7a91c67f2..8dd54bd3e6c15 100644
--- a/libcxx/test/libcxx/utilities/expected/nodiscard.verify.cpp
+++ b/libcxx/test/libcxx/utilities/expected/nodiscard.verify.cpp
@@ -47,6 +47,7 @@ void test() {
*std::move(exp); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
exp.has_value(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ exp.has_error(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
cExp.value(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
exp.value(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
@@ -110,6 +111,7 @@ void test() {
const std::expected<void, int> cVExp{};
vExp.has_value(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ vExp.has_error(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
// expected-warning at +1 {{ignoring return value of function declared with 'nodiscard' attribute}}
cVExp.error();
diff --git a/libcxx/test/std/utilities/expected/expected.expected/observers/has_error.pass.cpp b/libcxx/test/std/utilities/expected/expected.expected/observers/has_error.pass.cpp
index 80591aec36532..93ee0ea2dfeea 100644
--- a/libcxx/test/std/utilities/expected/expected.expected/observers/has_error.pass.cpp
+++ b/libcxx/test/std/utilities/expected/expected.expected/observers/has_error.pass.cpp
@@ -6,7 +6,7 @@
//
//===----------------------------------------------------------------------===//
-// REQUIRES: std-at-least-c++29
+// REQUIRES: std-at-least-c++23
// constexpr bool has_error() const noexcept;
@@ -18,12 +18,12 @@
#include "../../types.h"
-static_assert(noexcept(std::expected<int, int>().has_error()));
-
constexpr bool test() {
{
const std::expected<int, int> e(std::unexpect, 5);
- assert(e.has_error());
+ static_assert(noexcept(e.has_error()));
+ std::same_as<bool> decltype(auto) has_err = e.has_error();
+ assert(has_err);
}
{
@@ -34,18 +34,9 @@ constexpr bool test() {
return true;
}
-constexpr bool test_nodiscard() {
- std::expected<int, int> e;
- e.has_error(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
-
- return true;
-}
-
int main(int, char**) {
test();
static_assert(test());
- test_nodiscard();
- static_assert(test_nodiscard());
return 0;
}
diff --git a/libcxx/test/std/utilities/expected/expected.void/observers/has_error.pass.cpp b/libcxx/test/std/utilities/expected/expected.void/observers/has_error.pass.cpp
index fdab2c39af6ee..3072530066361 100644
--- a/libcxx/test/std/utilities/expected/expected.void/observers/has_error.pass.cpp
+++ b/libcxx/test/std/utilities/expected/expected.void/observers/has_error.pass.cpp
@@ -6,7 +6,7 @@
//
//===----------------------------------------------------------------------===//
-// REQUIRES: std-at-least-c++29
+// REQUIRES: std-at-least-c++23
// constexpr bool has_error() const noexcept;
@@ -18,12 +18,12 @@
#include "../../types.h"
-static_assert(noexcept(std::expected<void, int>().has_error()));
-
constexpr bool test() {
{
const std::expected<void, int> e(std::unexpect, 5);
- assert(e.has_error());
+ static_assert(noexcept(e.has_error()));
+ std::same_as<bool> decltype(auto) has_err = e.has_error();
+ assert(has_err);
}
{
@@ -34,18 +34,9 @@ constexpr bool test() {
return true;
}
-constexpr bool test_nodiscard() {
- std::expected<void, int> e;
- e.has_error(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
-
- return true;
-}
-
int main(int, char**) {
test();
static_assert(test());
- test_nodiscard();
- static_assert(test_nodiscard());
return 0;
}
diff --git a/libcxx/utils/generate_feature_test_macro_components.py b/libcxx/utils/generate_feature_test_macro_components.py
index b8cc9113e8fb0..b643f252b3846 100644
--- a/libcxx/utils/generate_feature_test_macro_components.py
+++ b/libcxx/utils/generate_feature_test_macro_components.py
@@ -557,7 +557,7 @@ def add_version_header(tc):
},
{
"name": "__cpp_lib_expected",
- "values": {"c++23": 202211, "c++29": 202606},
+ "values": {"c++23": 202606},
"headers": ["expected"],
},
{
>From ef2ca67d16eb6f5071be07ce7fdb1e7a7909dca9 Mon Sep 17 00:00:00 2001
From: Alex Kremer <akremer at ripple.com>
Date: Mon, 22 Jun 2026 11:13:53 +0100
Subject: [PATCH 5/6] Add back space
---
libcxx/docs/ReleaseNotes/23.rst | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libcxx/docs/ReleaseNotes/23.rst b/libcxx/docs/ReleaseNotes/23.rst
index a693be565b544..d077a72e623f9 100644
--- a/libcxx/docs/ReleaseNotes/23.rst
+++ b/libcxx/docs/ReleaseNotes/23.rst
@@ -53,7 +53,7 @@ Implemented Papers
- P3369R0: constexpr for ``uninitialized_default_construct`` (`Github <https://llvm.org/PR118380>`__)
- P3508R0: Wording for "constexpr for specialized memory algorithms" (`Github <https://llvm.org/PR118379>`__)
- P3798R1: The unexpected in ``std::expected`` (`Github <https://llvm.org/PR204394>`__)
-
+
Improvements and New Features
-----------------------------
>From c11ff59ea06f6eae56951852998bb7cfe75bd1e8 Mon Sep 17 00:00:00 2001
From: Alex Kremer <akremer at ripple.com>
Date: Mon, 22 Jun 2026 11:58:14 +0100
Subject: [PATCH 6/6] Regenerate version checks
---
libcxx/docs/FeatureTestMacroTable.rst | 2 +-
libcxx/include/version | 4 ++--
.../expected.version.compile.pass.cpp | 8 ++++----
.../version.version.compile.pass.cpp | 8 ++++----
4 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/libcxx/docs/FeatureTestMacroTable.rst b/libcxx/docs/FeatureTestMacroTable.rst
index 8e26bdcd860c1..0230e17e87d9c 100644
--- a/libcxx/docs/FeatureTestMacroTable.rst
+++ b/libcxx/docs/FeatureTestMacroTable.rst
@@ -332,7 +332,7 @@ Status
---------------------------------------------------------- -----------------
``__cpp_lib_containers_ranges`` ``202202L``
---------------------------------------------------------- -----------------
- ``__cpp_lib_expected`` ``202211L``
+ ``__cpp_lib_expected`` ``202606L``
---------------------------------------------------------- -----------------
``__cpp_lib_flat_map`` ``202511L``
---------------------------------------------------------- -----------------
diff --git a/libcxx/include/version b/libcxx/include/version
index 7f2dc9e4b72ab..d0e44e132e998 100644
--- a/libcxx/include/version
+++ b/libcxx/include/version
@@ -111,7 +111,7 @@ __cpp_lib_erase_if 202002L <deque> <forward
__cpp_lib_exchange_function 201304L <utility>
__cpp_lib_execution 201902L <execution>
201603L // C++17
-__cpp_lib_expected 202211L <expected>
+__cpp_lib_expected 202606L <expected>
__cpp_lib_filesystem 201703L <filesystem>
__cpp_lib_flat_map 202511L <flat_map>
__cpp_lib_flat_set 202511L <flat_set>
@@ -502,7 +502,7 @@ __cpp_lib_void_t 201411L <type_traits>
# define __cpp_lib_constexpr_memory 202202L
# define __cpp_lib_constexpr_typeinfo 202106L
# define __cpp_lib_containers_ranges 202202L
-# define __cpp_lib_expected 202211L
+# define __cpp_lib_expected 202606L
# define __cpp_lib_flat_map 202511L
# define __cpp_lib_flat_set 202511L
# define __cpp_lib_format_ranges 202207L
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/expected.version.compile.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/expected.version.compile.pass.cpp
index 4ec6c469dce4c..70217f98a8570 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/expected.version.compile.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/expected.version.compile.pass.cpp
@@ -83,8 +83,8 @@
# ifndef __cpp_lib_expected
# error "__cpp_lib_expected should be defined in c++23"
# endif
-# if __cpp_lib_expected != 202211L
-# error "__cpp_lib_expected should have the value 202211L in c++23"
+# if __cpp_lib_expected != 202606L
+# error "__cpp_lib_expected should have the value 202606L in c++23"
# endif
# ifdef __cpp_lib_freestanding_expected
@@ -103,8 +103,8 @@
# ifndef __cpp_lib_expected
# error "__cpp_lib_expected should be defined in c++26"
# endif
-# if __cpp_lib_expected != 202211L
-# error "__cpp_lib_expected should have the value 202211L in c++26"
+# if __cpp_lib_expected != 202606L
+# error "__cpp_lib_expected should have the value 202606L in c++26"
# endif
# if !defined(_LIBCPP_VERSION)
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/version.version.compile.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/version.version.compile.pass.cpp
index d9c78b73f7e23..c3058dd6f4680 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/version.version.compile.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/version.version.compile.pass.cpp
@@ -5133,8 +5133,8 @@
# ifndef __cpp_lib_expected
# error "__cpp_lib_expected should be defined in c++23"
# endif
-# if __cpp_lib_expected != 202211L
-# error "__cpp_lib_expected should have the value 202211L in c++23"
+# if __cpp_lib_expected != 202606L
+# error "__cpp_lib_expected should have the value 202606L in c++23"
# endif
# if !defined(_LIBCPP_VERSION) || _LIBCPP_HAS_FILESYSTEM
@@ -6903,8 +6903,8 @@
# ifndef __cpp_lib_expected
# error "__cpp_lib_expected should be defined in c++26"
# endif
-# if __cpp_lib_expected != 202211L
-# error "__cpp_lib_expected should have the value 202211L in c++26"
+# if __cpp_lib_expected != 202606L
+# error "__cpp_lib_expected should have the value 202606L in c++26"
# endif
# if !defined(_LIBCPP_VERSION) || _LIBCPP_HAS_FILESYSTEM
More information about the libcxx-commits
mailing list