[libcxx-commits] [libcxx] be1cb0b - [libc++] Fix `expected::error_or(...) &&` test (#215553)
via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Aug 11 23:51:58 PDT 2026
Author: David Bayer
Date: 2026-08-12T14:51:53+08:00
New Revision: be1cb0b1667ef770d883380de7c680c73b92db31
URL: https://github.com/llvm/llvm-project/commit/be1cb0b1667ef770d883380de7c680c73b92db31
DIFF: https://github.com/llvm/llvm-project/commit/be1cb0b1667ef770d883380de7c680c73b92db31.diff
LOG: [libc++] Fix `expected::error_or(...) &&` test (#215553)
In tests that should test the `expected::error_or(...) &&` member
function the `e` member is declared as `const`, thus the `const &`
version is used and the `&&` overload stays untested. This PR removes
the `const` specifier from the variable.
Added:
Modified:
libcxx/test/std/utilities/expected/expected.expected/observers/error_or.pass.cpp
libcxx/test/std/utilities/expected/expected.void/observers/error_or.pass.cpp
Removed:
################################################################################
diff --git a/libcxx/test/std/utilities/expected/expected.expected/observers/error_or.pass.cpp b/libcxx/test/std/utilities/expected/expected.expected/observers/error_or.pass.cpp
index f698f44ba8f3a..3052bc2974066 100644
--- a/libcxx/test/std/utilities/expected/expected.expected/observers/error_or.pass.cpp
+++ b/libcxx/test/std/utilities/expected/expected.expected/observers/error_or.pass.cpp
@@ -39,14 +39,14 @@ constexpr bool test_default_template_arg() {
// &&, has_value()
{
- const std::expected<int, ConstructFromInt> e(5);
+ std::expected<int, ConstructFromInt> e(5);
std::same_as<ConstructFromInt> decltype(auto) x = std::move(e).error_or(10);
assert(x.value == 10);
}
// &&, !has_value()
{
- const std::expected<int, ConstructFromInt> e(std::unexpect, 5);
+ std::expected<int, ConstructFromInt> e(std::unexpect, 5);
std::same_as<ConstructFromInt> decltype(auto) x = std::move(e).error_or(10);
assert(x.value == 5);
}
diff --git a/libcxx/test/std/utilities/expected/expected.void/observers/error_or.pass.cpp b/libcxx/test/std/utilities/expected/expected.void/observers/error_or.pass.cpp
index db2891f61c3cb..e5d9b1dc2eeaf 100644
--- a/libcxx/test/std/utilities/expected/expected.void/observers/error_or.pass.cpp
+++ b/libcxx/test/std/utilities/expected/expected.void/observers/error_or.pass.cpp
@@ -39,14 +39,14 @@ constexpr bool test_default_template_arg() {
// &&, has_value()
{
- const std::expected<void, ConstructFromInt> e;
+ std::expected<void, ConstructFromInt> e;
std::same_as<ConstructFromInt> decltype(auto) x = std::move(e).error_or(10);
assert(x.value == 10);
}
// &&, !has_value()
{
- const std::expected<void, ConstructFromInt> e(std::unexpect, 5);
+ std::expected<void, ConstructFromInt> e(std::unexpect, 5);
std::same_as<ConstructFromInt> decltype(auto) x = std::move(e).error_or(10);
assert(x.value == 5);
}
More information about the libcxx-commits
mailing list