You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: libcxx/test/libcxx/utilities/expected/expected.expected/and_then.mandates.verify.cpp
+9-8Lines changed: 9 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -30,6 +30,7 @@
30
30
// U is a specialization of std::expected and std::is_same_v<U:error_type, E> is true
31
31
32
32
#include<expected>
33
+
#include<tuple>
33
34
#include<utility>
34
35
35
36
structNotSameAsInt {};
@@ -51,7 +52,7 @@ void test() {
51
52
// U is not a specialization of std::expected
52
53
{
53
54
std::expected<int, int> f1(1);
54
-
(void)f1.and_then(lval_return_not_std_expected); // expected-note{{in instantiation of function template specialization 'std::expected<int, int>::and_then<int (&)(int &)>' requested here}}
55
+
std::ignore = f1.and_then(lval_return_not_std_expected); // expected-note{{in instantiation of function template specialization 'std::expected<int, int>::and_then<int (&)(int &)>' requested here}}
55
56
// expected-error-re@*:* {{static assertion failed {{.*}}The result of f(value()) must be a specialization of std::expected}}
56
57
// expected-error-re@*:* {{{{.*}}cannot be used prior to '::' because it has no members}}
57
58
// expected-error-re@*:* {{no matching constructor for initialization of{{.*}}}}
@@ -60,7 +61,7 @@ void test() {
60
61
// !std::is_same_v<U:error_type, E>
61
62
{
62
63
std::expected<int, int> f1(1);
63
-
(void)f1.and_then(lval_error_type_not_same_as_int); // expected-note{{in instantiation of function template specialization 'std::expected<int, int>::and_then<std::expected<int, NotSameAsInt> (&)(int &)>' requested here}}
64
+
std::ignore = f1.and_then(lval_error_type_not_same_as_int); // expected-note{{in instantiation of function template specialization 'std::expected<int, int>::and_then<std::expected<int, NotSameAsInt> (&)(int &)>' requested here}}
64
65
// expected-error-re@*:* {{static assertion failed {{.*}}The result of f(value()) must have the same error_type as this expected}}
65
66
}
66
67
}
@@ -70,7 +71,7 @@ void test() {
70
71
// U is not a specialization of std::expected
71
72
{
72
73
const std::expected<int, int> f1(1);
73
-
(void)f1.and_then(clval_return_not_std_expected); // expected-note{{in instantiation of function template specialization 'std::expected<int, int>::and_then<int (&)(const int &)>' requested here}}
74
+
std::ignore = f1.and_then(clval_return_not_std_expected); // expected-note{{in instantiation of function template specialization 'std::expected<int, int>::and_then<int (&)(const int &)>' requested here}}
74
75
// expected-error-re@*:* {{static assertion failed {{.*}}The result of f(value()) must be a specialization of std::expected}}
75
76
// expected-error-re@*:* {{{{.*}}cannot be used prior to '::' because it has no members}}
76
77
// expected-error-re@*:* {{no matching constructor for initialization of{{.*}}}}
@@ -79,7 +80,7 @@ void test() {
79
80
// !std::is_same_v<U:error_type, E>
80
81
{
81
82
const std::expected<int, int> f1(1);
82
-
(void)f1.and_then(clval_error_type_not_same_as_int); // expected-note{{in instantiation of function template specialization 'std::expected<int, int>::and_then<std::expected<int, NotSameAsInt> (&)(const int &)>' requested here}}
83
+
std::ignore = f1.and_then(clval_error_type_not_same_as_int); // expected-note{{in instantiation of function template specialization 'std::expected<int, int>::and_then<std::expected<int, NotSameAsInt> (&)(const int &)>' requested here}}
83
84
// expected-error-re@*:* {{static assertion failed {{.*}}The result of f(value()) must have the same error_type as this expected}}
84
85
85
86
}
@@ -90,7 +91,7 @@ void test() {
90
91
// U is not a specialization of std::expected
91
92
{
92
93
std::expected<int, int> f1(1);
93
-
(void)std::move(f1).and_then(rval_return_not_std_expected); // expected-note{{in instantiation of function template specialization 'std::expected<int, int>::and_then<int (&)(int &&)>' requested here}}
94
+
std::ignore = std::move(f1).and_then(rval_return_not_std_expected); // expected-note{{in instantiation of function template specialization 'std::expected<int, int>::and_then<int (&)(int &&)>' requested here}}
94
95
// expected-error-re@*:* {{static assertion failed {{.*}}The result of f(std::move(value())) must be a specialization of std::expected}}
95
96
// expected-error-re@*:* {{{{.*}}cannot be used prior to '::' because it has no members}}
96
97
// expected-error-re@*:* {{no matching constructor for initialization of{{.*}}}}
@@ -99,7 +100,7 @@ void test() {
99
100
// !std::is_same_v<U:error_type, E>
100
101
{
101
102
std::expected<int, int> f1(1);
102
-
(void)std::move(f1).and_then(rval_error_type_not_same_as_int); // expected-note{{in instantiation of function template specialization 'std::expected<int, int>::and_then<std::expected<int, NotSameAsInt> (&)(int &&)>' requested here}}
103
+
std::ignore = std::move(f1).and_then(rval_error_type_not_same_as_int); // expected-note{{in instantiation of function template specialization 'std::expected<int, int>::and_then<std::expected<int, NotSameAsInt> (&)(int &&)>' requested here}}
103
104
// expected-error-re@*:* {{static assertion failed {{.*}}The result of f(std::move(value())) must have the same error_type as this expected}}
104
105
}
105
106
}
@@ -109,7 +110,7 @@ void test() {
109
110
// U is not a specialization of std::expected
110
111
{
111
112
const std::expected<int, int> f1(1);
112
-
(void)std::move(f1).and_then(crval_return_not_std_expected); // expected-note{{in instantiation of function template specialization 'std::expected<int, int>::and_then<int (&)(const int &&)>' requested here}}
113
+
std::ignore = std::move(f1).and_then(crval_return_not_std_expected); // expected-note{{in instantiation of function template specialization 'std::expected<int, int>::and_then<int (&)(const int &&)>' requested here}}
113
114
// expected-error-re@*:* {{static assertion failed {{.*}}The result of f(std::move(value())) must be a specialization of std::expected}}
114
115
// expected-error-re@*:* {{{{.*}}cannot be used prior to '::' because it has no members}}
115
116
// expected-error-re@*:* {{no matching constructor for initialization of{{.*}}}}
@@ -118,7 +119,7 @@ void test() {
118
119
// !std::is_same_v<U:error_type, E>
119
120
{
120
121
const std::expected<int, int> f1(1);
121
-
(void)std::move(f1).and_then(crval_error_type_not_same_as_int); // expected-note{{in instantiation of function template specialization 'std::expected<int, int>::and_then<std::expected<int, NotSameAsInt> (&)(const int &&)>' requested here}}
122
+
std::ignore = std::move(f1).and_then(crval_error_type_not_same_as_int); // expected-note{{in instantiation of function template specialization 'std::expected<int, int>::and_then<std::expected<int, NotSameAsInt> (&)(const int &&)>' requested here}}
122
123
// expected-error-re@*:* {{static assertion failed {{.*}}The result of f(std::move(value())) must have the same error_type as this expected}}
(void)f1.or_else(clval_return_not_std_expected); // expected-note{{in instantiation of function template specialization 'std::expected<int, int>::or_else<int (&)(const int &)>' requested here}}
74
+
std::ignore = f1.or_else(clval_return_not_std_expected); // expected-note{{in instantiation of function template specialization 'std::expected<int, int>::or_else<int (&)(const int &)>' requested here}}
74
75
// expected-error-re@*:* {{static assertion failed {{.*}}The result of f(error()) must be a specialization of std::expected}}
75
76
// expected-error-re@*:* {{{{.*}}cannot be used prior to '::' because it has no members}}
76
77
// expected-error-re@*:* {{no matching constructor for initialization of{{.*}}}}
(void)std::move(f1).or_else(crval_return_not_std_expected); // expected-note{{in instantiation of function template specialization 'std::expected<int, int>::or_else<int (&)(const int &&)>' requested here}}
112
+
std::ignore = std::move(f1).or_else(crval_return_not_std_expected); // expected-note{{in instantiation of function template specialization 'std::expected<int, int>::or_else<int (&)(const int &&)>' requested here}}
112
113
// expected-error-re@*:* {{static assertion failed {{.*}}The result of f(std::move(error())) must be a specialization of std::expected}}
113
114
// expected-error-re@*:* {{{{.*}}cannot be used prior to '::' because it has no members}}
114
115
// expected-error-re@*:* {{no matching constructor for initialization of{{.*}}}}
Copy file name to clipboardExpand all lines: libcxx/test/libcxx/utilities/expected/expected.expected/transform_error.mandates.verify.cpp
+9-8Lines changed: 9 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -38,6 +38,7 @@
38
38
// G g(invoke(std::forward<F>(f), std::move(error()))); is well-formed.
39
39
40
40
#include<expected>
41
+
#include<tuple>
41
42
#include<utility>
42
43
43
44
staticint val;
@@ -58,12 +59,12 @@ void test() {
58
59
// Test & overload
59
60
{
60
61
std::expected<int, int> e;
61
-
e.transform_error(return_unexpected<int&>); // expected-error-re@*:* {{static assertion failed {{.*}}The result of {{.*}} must be a valid template argument for unexpected}}
62
+
std::ignore = e.transform_error(return_unexpected<int&>); // expected-error-re@*:* {{static assertion failed {{.*}}The result of {{.*}} must be a valid template argument for unexpected}}
62
63
// expected-error-re@*:* 0-1 {{{{(excess elements in struct initializer|no matching constructor for initialization of)}}{{.*}}}}
63
64
// expected-error-re@*:* {{static assertion failed {{.*}}[expected.object.general] A program that instantiates the definition of template expected<T, E> for {{.*}} is ill-formed.}}
64
65
// expected-error-re@*:* 0-1 {{union member {{.*}} has reference type {{.*}}}}
65
66
66
-
e.transform_error(return_no_object<int&>); // expected-error-re@*:* {{static assertion failed {{.*}}The result of {{.*}} must be a valid template argument for unexpected}}
67
+
std::ignore = e.transform_error(return_no_object<int&>); // expected-error-re@*:* {{static assertion failed {{.*}}The result of {{.*}} must be a valid template argument for unexpected}}
67
68
// expected-error-re@*:* 0-1 {{{{(excess elements in struct initializer|no matching constructor for initialization of)}}{{.*}}}}
68
69
// expected-error-re@*:* {{static assertion failed {{.*}}[expected.object.general] A program that instantiates the definition of template expected<T, E> for {{.*}} is ill-formed.}}
69
70
// expected-warning-re@*:* 0-1 {{union member {{.*}} has reference type {{.*}}, which is a Microsoft extension}}
@@ -72,27 +73,27 @@ void test() {
72
73
// Test const& overload
73
74
{
74
75
const std::expected<int, int> e;
75
-
e.transform_error(return_unexpected<constint &>); // expected-error-re@*:* {{static assertion failed {{.*}}The result of {{.*}} must be a valid template argument for unexpected}}
76
+
std::ignore = e.transform_error(return_unexpected<constint &>); // expected-error-re@*:* {{static assertion failed {{.*}}The result of {{.*}} must be a valid template argument for unexpected}}
76
77
// expected-error-re@*:* 0-2 {{{{(excess elements in struct initializer|no matching constructor for initialization of)}}{{.*}}}}
77
-
e.transform_error(return_no_object<constint &>); // expected-error-re@*:* {{static assertion failed {{.*}}The result of {{.*}} must be a valid template argument for unexpected}}
78
+
std::ignore = e.transform_error(return_no_object<constint &>); // expected-error-re@*:* {{static assertion failed {{.*}}The result of {{.*}} must be a valid template argument for unexpected}}
78
79
// expected-error-re@*:* 0-2 {{{{(excess elements in struct initializer|no matching constructor for initialization of)}}{{.*}}}}
79
80
}
80
81
81
82
// Test && overload
82
83
{
83
84
std::expected<int, int> e;
84
-
std::move(e).transform_error(return_unexpected<int&&>); // expected-error-re@*:* {{static assertion failed {{.*}}The result of {{.*}} must be a valid template argument for unexpected}}
85
+
std::ignore = std::move(e).transform_error(return_unexpected<int&&>); // expected-error-re@*:* {{static assertion failed {{.*}}The result of {{.*}} must be a valid template argument for unexpected}}
85
86
// expected-error-re@*:* 0-2 {{{{(excess elements in struct initializer|no matching constructor for initialization of)}}{{.*}}}}
86
-
std::move(e).transform_error(return_no_object<int&&>); // expected-error-re@*:* {{static assertion failed {{.*}}The result of {{.*}} must be a valid template argument for unexpected}}
87
+
std::ignore = std::move(e).transform_error(return_no_object<int&&>); // expected-error-re@*:* {{static assertion failed {{.*}}The result of {{.*}} must be a valid template argument for unexpected}}
87
88
// expected-error-re@*:* 0-2 {{{{(excess elements in struct initializer|no matching constructor for initialization of)}}{{.*}}}}
88
89
}
89
90
90
91
// Test const&& overload
91
92
{
92
93
const std::expected<int, int> e;
93
-
std::move(e).transform_error(return_unexpected<constint&&>); // expected-error-re@*:* {{static assertion failed {{.*}}The result of {{.*}} must be a valid template argument for unexpected}}
94
+
std::ignore = std::move(e).transform_error(return_unexpected<constint&&>); // expected-error-re@*:* {{static assertion failed {{.*}}The result of {{.*}} must be a valid template argument for unexpected}}
94
95
// expected-error-re@*:* 0-2 {{{{(excess elements in struct initializer|no matching constructor for initialization of)}}{{.*}}}}
95
-
std::move(e).transform_error(return_no_object<constint&&>); // expected-error-re@*:* {{static assertion failed {{.*}}The result of {{.*}} must be a valid template argument for unexpected}}
96
+
std::ignore = std::move(e).transform_error(return_no_object<constint&&>); // expected-error-re@*:* {{static assertion failed {{.*}}The result of {{.*}} must be a valid template argument for unexpected}}
96
97
// expected-error-re@*:* 0-2 {{{{(excess elements in struct initializer|no matching constructor for initialization of)}}{{.*}}}}
0 commit comments