Skip to content

Commit ca26274

Browse files
committed
trying to fix tests
1 parent aa6d39e commit ca26274

File tree

4 files changed

+17
-11
lines changed

4 files changed

+17
-11
lines changed

libcxx/test/libcxx/utilities/expected/expected.expected/and_then.mandates.verify.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,9 +126,11 @@ void test() {
126126

127127
// Test nodiscard
128128
{
129-
const std::expected<int, int> f1(std::unexpected<int>(1));
129+
std::expected<int, int> f1(1);
130130

131-
f1.and_then([](int& _){ return 1; }); // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}}
131+
f1.and_then([](const int&){ return std::expected<int, int>(1); }); // expected-warning {{ignoring return value of type 'expected<int, int>' declared with 'nodiscard' attribute}}
132+
// expected-error-re@*:* {{no type named 'type' in 'std::invoke_result<{{.*}}>'}}
133+
// expected-error-re@*:* {{static assertion failed {{.*}}The result of f({{.*}}) must be a specialization of std::expected}}
132134
}
133135
}
134136
// clang-format on

libcxx/test/libcxx/utilities/expected/expected.expected/or_else.mandates.verify.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,9 +125,11 @@ void test() {
125125

126126
// Test nodiscard
127127
{
128-
const std::expected<int, int> f1(std::unexpected<int>(1));
128+
std::expected<int, int> f1(1);
129129

130-
f1.or_else([](int&){ return 1; }); // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}}
130+
f1.or_else([](const int&){ return std::expected<int, int>(1); }); // expected-warning {{ignoring return value of type 'expected<int, int>' declared with 'nodiscard' attribute}}
131+
// expected-error-re@*:* {{no type named 'type' in 'std::invoke_result<{{.*}}>'}}
132+
// expected-error-re@*:* {{static assertion failed {{.*}}The result of f({{.*}}) must be a specialization of std::expected}}
131133
}
132134
}
133135
// clang-format on

libcxx/test/libcxx/utilities/expected/expected.void/and_then.mandates.verify.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,9 +125,11 @@ void test() {
125125

126126
// Test nodiscard
127127
{
128-
const std::expected<int, int> f1(std::unexpected<int>(1));
128+
std::expected<int, int> f1(1);
129129

130-
f1.and_then([](int& _){ return 1; }); // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}}
130+
f1.and_then([](void){ return std::expected<int, int>(1); }); // expected-warning {{ignoring return value of type 'expected<int, int>' declared with 'nodiscard' attribute}}
131+
// expected-error-re@*:* {{no type named 'type' in 'std::invoke_result<{{.*}}>'}}
132+
// expected-error-re@*:* {{static assertion failed {{.*}}The result of f({{.*}}) must be a specialization of std::expected}}
131133
}
132134
}
133135
// clang-format on

libcxx/test/libcxx/utilities/expected/expected.void/or_else.mandates.verify.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -121,11 +121,11 @@ void test() {
121121

122122
// Test nodiscard
123123
{
124-
std::expected<void, int> e(std::unexpected<int>(1));
125-
126-
// expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}}
127-
e.or_else([](const int&) -> std::expected<void, int> { return std::unexpected(1); });
128-
124+
std::expected<int, int> f1(1);
125+
126+
f1.or_else([](void){ return std::expected<int, int>(1); }); // expected-warning {{ignoring return value of type 'expected<int, int>' declared with 'nodiscard' attribute}}
127+
// expected-error-re@*:* {{no type named 'type' in 'std::invoke_result<{{.*}}>'}}
128+
// expected-error-re@*:* {{static assertion failed {{.*}}The result of f({{.*}}) must be a specialization of std::expected}}
129129
}
130130
}
131131
// clang-format on

0 commit comments

Comments
 (0)