Skip to content

Commit 6db9e47

Browse files
committed
Add test-results for pure2-expected-is-as test case
1 parent afc1b10 commit 6db9e47

File tree

11 files changed

+893
-9
lines changed

11 files changed

+893
-9
lines changed
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
pure2-expected-is-as.cpp2:7:10: error: no member named 'expected' in namespace 'std'
2+
std::expected<int,int> ex1 {123};
3+
~~~~~^
4+
pure2-expected-is-as.cpp2:7:22: error: expected '(' for function-style cast or type construction
5+
std::expected<int,int> ex1 {123};
6+
~~~^
7+
pure2-expected-is-as.cpp2:8:10: error: no member named 'expected' in namespace 'std'
8+
std::expected<int,int> ex2 {std::unexpected(-1)};
9+
~~~~~^
10+
pure2-expected-is-as.cpp2:8:22: error: expected '(' for function-style cast or type construction
11+
std::expected<int,int> ex2 {std::unexpected(-1)};
12+
~~~^
13+
pure2-expected-is-as.cpp2:9:10: error: no member named 'expected' in namespace 'std'
14+
std::expected<std::string,size_t> ex3 {"Expect the unexpected"};
15+
~~~~~^
16+
pure2-expected-is-as.cpp2:9:30: error: expected '(' for function-style cast or type construction
17+
std::expected<std::string,size_t> ex3 {"Expect the unexpected"};
18+
~~~~~~~~~~~^
19+
pure2-expected-is-as.cpp2:11:29: error: use of undeclared identifier 'ex1'
20+
if (cpp2::impl::is<int>(ex1)) {
21+
^
22+
pure2-expected-is-as.cpp2:15:30: error: use of undeclared identifier 'ex1'
23+
if (cpp2::impl::is<bool>(ex1)) {
24+
^
25+
pure2-expected-is-as.cpp2:20:30: error: use of undeclared identifier 'ex1'
26+
if (cpp2::impl::is<void>(ex1)) {
27+
^
28+
pure2-expected-is-as.cpp2:25:29: error: no member named 'unexpected' in namespace 'std'
29+
if (cpp2::impl::is<std::unexpected<int>>(ex1)) {
30+
~~~~~^
31+
pure2-expected-is-as.cpp2:25:43: error: expected '(' for function-style cast or type construction
32+
if (cpp2::impl::is<std::unexpected<int>>(ex1)) {
33+
~~~^
34+
pure2-expected-is-as.cpp2:25:46: error: use of undeclared identifier 'ex1'; did you mean 'exp'?
35+
if (cpp2::impl::is<std::unexpected<int>>(ex1)) {
36+
^~~
37+
exp
38+
/Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk/usr/include/c++/v1/math.h:895:1: note: 'exp' declared here
39+
exp(_A1 __lcpp_x) _NOEXCEPT {return ::exp((double)__lcpp_x);}
40+
^
41+
pure2-expected-is-as.cpp2:30:24: error: use of undeclared identifier 'ex1'
42+
if (cpp2::impl::is(ex1, 123)) {
43+
^
44+
pure2-expected-is-as.cpp2:34:24: error: use of undeclared identifier 'ex1'
45+
if (cpp2::impl::is(ex1, 100)) {
46+
^
47+
pure2-expected-is-as.cpp2:39:37: error: use of undeclared identifier 'ex1'
48+
auto val1 {cpp2::impl::as_<int>(ex1)};
49+
^
50+
pure2-expected-is-as.cpp2:42:29: error: use of undeclared identifier 'ex2'
51+
if (cpp2::impl::is<int>(ex2)) {
52+
^
53+
pure2-expected-is-as.cpp2:47:30: error: use of undeclared identifier 'ex2'
54+
if (cpp2::impl::is<bool>(ex2)) {
55+
^
56+
pure2-expected-is-as.cpp2:52:24: error: use of undeclared identifier 'ex2'
57+
if (cpp2::impl::is(ex2, 123)) {
58+
^
59+
pure2-expected-is-as.cpp2:57:29: error: no member named 'unexpected' in namespace 'std'
60+
if (cpp2::impl::is<std::unexpected<int>>(ex2)) {
61+
~~~~~^
62+
fatal error: too many errors emitted, stopping now [-ferror-limit=]
63+
20 errors generated.
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
ex1 is int
2+
ex1 is 123
3+
ex1 as int = 123
4+
ex2 is unexpected<int> and error is: -1
5+
ex2 is 'empty' aka unexpected<int> and error is: -1
6+
ex2 as std::unexpected<int> and error = -1
7+
8+
expected<int, int> with value
9+
...integer 123
10+
11+
expected<int, int> with unexpected
12+
...unexpected<int> -1
13+
14+
expected<string, size_t> with value
15+
...string Expect the unexpected
Lines changed: 169 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,169 @@
1+
pure2-expected-is-as.cpp2:7:22: error: expected '(' for function-style cast or type construction
2+
std::expected<int,int> ex1 {123};
3+
~~~^
4+
pure2-expected-is-as.cpp2:7:10: error: no member named 'expected' in namespace 'std'; did you mean 'unexpected'?
5+
std::expected<int,int> ex1 {123};
6+
~~~~~^~~~~~~~
7+
unexpected
8+
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/exception:92:8: note: 'unexpected' declared here
9+
void unexpected() __attribute__ ((__noreturn__));
10+
^
11+
pure2-expected-is-as.cpp2:8:22: error: expected '(' for function-style cast or type construction
12+
std::expected<int,int> ex2 {std::unexpected(-1)};
13+
~~~^
14+
pure2-expected-is-as.cpp2:8:10: error: no member named 'expected' in namespace 'std'; did you mean 'unexpected'?
15+
std::expected<int,int> ex2 {std::unexpected(-1)};
16+
~~~~~^~~~~~~~
17+
unexpected
18+
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/exception:92:8: note: 'unexpected' declared here
19+
void unexpected() __attribute__ ((__noreturn__));
20+
^
21+
pure2-expected-is-as.cpp2:9:30: error: expected '(' for function-style cast or type construction
22+
std::expected<std::string,size_t> ex3 {"Expect the unexpected"};
23+
~~~~~~~~~~~^
24+
pure2-expected-is-as.cpp2:9:10: error: no member named 'expected' in namespace 'std'; did you mean 'unexpected'?
25+
std::expected<std::string,size_t> ex3 {"Expect the unexpected"};
26+
~~~~~^~~~~~~~
27+
unexpected
28+
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/exception:92:8: note: 'unexpected' declared here
29+
void unexpected() __attribute__ ((__noreturn__));
30+
^
31+
pure2-expected-is-as.cpp2:11:29: error: use of undeclared identifier 'ex1'; did you mean 'exp'?
32+
if (cpp2::impl::is<int>(ex1)) {
33+
^~~
34+
exp
35+
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:95:17: note: 'exp' declared here
36+
__MATHCALL_VEC (exp,, (_Mdouble_ __x));
37+
^
38+
pure2-expected-is-as.cpp2:15:30: error: use of undeclared identifier 'ex1'; did you mean 'exp'?
39+
if (cpp2::impl::is<bool>(ex1)) {
40+
^~~
41+
exp
42+
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:95:17: note: 'exp' declared here
43+
__MATHCALL_VEC (exp,, (_Mdouble_ __x));
44+
^
45+
pure2-expected-is-as.cpp2:20:30: error: use of undeclared identifier 'ex1'; did you mean 'exp'?
46+
if (cpp2::impl::is<void>(ex1)) {
47+
^~~
48+
exp
49+
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:95:17: note: 'exp' declared here
50+
__MATHCALL_VEC (exp,, (_Mdouble_ __x));
51+
^
52+
pure2-expected-is-as.cpp2:25:29: error: 'unexpected' does not name a template but is followed by template arguments
53+
if (cpp2::impl::is<std::unexpected<int>>(ex1)) {
54+
^ ~~~~~
55+
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/exception:92:8: note: non-template declaration found by name lookup
56+
void unexpected() __attribute__ ((__noreturn__));
57+
^
58+
pure2-expected-is-as.cpp2:25:46: error: use of undeclared identifier 'ex1'; did you mean 'exp'?
59+
if (cpp2::impl::is<std::unexpected<int>>(ex1)) {
60+
^~~
61+
exp
62+
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:95:17: note: 'exp' declared here
63+
__MATHCALL_VEC (exp,, (_Mdouble_ __x));
64+
^
65+
pure2-expected-is-as.cpp2:30:24: error: use of undeclared identifier 'ex1'; did you mean 'exp'?
66+
if (cpp2::impl::is(ex1, 123)) {
67+
^~~
68+
exp
69+
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:95:17: note: 'exp' declared here
70+
__MATHCALL_VEC (exp,, (_Mdouble_ __x));
71+
^
72+
pure2-expected-is-as.cpp2:34:24: error: use of undeclared identifier 'ex1'; did you mean 'exp'?
73+
if (cpp2::impl::is(ex1, 100)) {
74+
^~~
75+
exp
76+
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:95:17: note: 'exp' declared here
77+
__MATHCALL_VEC (exp,, (_Mdouble_ __x));
78+
^
79+
In file included from pure2-expected-is-as.cpp:7:
80+
../../../include/cpp2util.h:1770:72: error: invalid application of 'sizeof' to a function type
81+
(std::is_floating_point_v<From> && std::is_floating_point_v<To> && sizeof(From) > sizeof(To)) || // NOLINT(misc-redundant-expression)
82+
^~~~~~~~~~~~
83+
../../../include/cpp2util.h:2891:19: note: in instantiation of variable template specialization 'cpp2::impl::is_narrowing_v' requested here
84+
if constexpr (is_narrowing_v<C, CPP2_TYPEOF(x)>) {
85+
^
86+
pure2-expected-is-as.cpp2:39:28: note: in instantiation of function template specialization 'cpp2::impl::as_<int, double (&)(double) noexcept>' requested here
87+
auto val1 {cpp2::impl::as_<int>(ex1)};
88+
^
89+
In file included from pure2-expected-is-as.cpp:7:
90+
../../../include/cpp2util.h:2911:12: error: no matching function for call to 'as'
91+
return as<C>(CPP2_FORWARD(x));
92+
^~~~~
93+
pure2-expected-is-as.cpp2:39:28: note: in instantiation of function template specialization 'cpp2::impl::as_<int, double (&)(double) noexcept>' requested here
94+
auto val1 {cpp2::impl::as_<int>(ex1)};
95+
^
96+
../../../include/cpp2util.h:1838:16: note: candidate template ignored: constraints not satisfied [with C = int, x:auto = double (&)(double) noexcept]
97+
constexpr auto as(auto&& x CPP2_SOURCE_LOCATION_PARAM_WITH_DEFAULT_AS) -> decltype(auto)
98+
^
99+
../../../include/cpp2util.h:1844:18: note: because 'std::is_scalar_v<std::remove_cvref_t<decltype(x)> >' evaluated to false
100+
(std::is_scalar_v<CPP2_TYPEOF(x)> && !std::is_enum_v<CPP2_TYPEOF(x)>)
101+
^
102+
../../../include/cpp2util.h:1845:17: note: and 'std::is_floating_point_v<std::remove_cvref_t<decltype(x)> >' evaluated to false
103+
|| std::is_floating_point_v<CPP2_TYPEOF(x)>
104+
^
105+
../../../include/cpp2util.h:1846:17: note: and 'std::is_base_of_v<int, std::remove_cvref_t<decltype(x)> >' evaluated to false
106+
|| std::is_base_of_v<C, CPP2_TYPEOF(x)>
107+
^
108+
../../../include/cpp2util.h:1847:17: note: and 'std::is_base_of_v<std::remove_cvref_t<decltype(x)>, int>' evaluated to false
109+
|| std::is_base_of_v<CPP2_TYPEOF(x), C>
110+
^
111+
../../../include/cpp2util.h:1848:30: note: and 'C({std::forward<decltype(x)>(x)})' would be invalid: cannot initialize a value of type 'int' with an lvalue of type 'double (double) noexcept'
112+
|| requires { C{CPP2_FORWARD(x)}; }
113+
^
114+
../../../include/cpp2util.h:325:37: note: expanded from macro 'CPP2_FORWARD'
115+
#define CPP2_FORWARD(x) std::forward<decltype(x)>(x)
116+
^
117+
../../../include/cpp2util.h:1977:6: note: candidate template ignored: constraints not satisfied [with C = int, X = double (&)(double) noexcept]
118+
auto as(X&& x CPP2_SOURCE_LOCATION_PARAM_WITH_DEFAULT_AS) -> decltype(auto)
119+
^
120+
../../../include/cpp2util.h:1976:23: note: because 'specialization_of_template<double (&)(double) noexcept, std::variant>' evaluated to false
121+
template< typename C, specialization_of_template<std::variant> X >
122+
^
123+
../../../include/cpp2util.h:724:7: note: because 'specialization_of_template_helper<C>(std::forward<X>(x))' would be invalid: no matching function for call to 'specialization_of_template_helper'
124+
{ specialization_of_template_helper<C>(std::forward<X>(x)) } -> std::same_as<std::true_type>;
125+
^
126+
../../../include/cpp2util.h:2024:16: note: candidate template ignored: constraints not satisfied [with T = int, X = double (&)(double) noexcept]
127+
constexpr auto as( X && x ) -> decltype(auto) {
128+
^
129+
../../../include/cpp2util.h:2023:22: note: because 'same_type_as<double (&)(double) noexcept, std::any>' evaluated to false
130+
template<typename T, same_type_as<std::any> X>
131+
^
132+
../../../include/cpp2util.h:754:29: note: because 'std::same_as<std::remove_cvref_t<double (&)(double) noexcept>, std::remove_cvref_t<any> >' evaluated to false
133+
concept same_type_as = std::same_as<std::remove_cvref_t<X>, std::remove_cvref_t<C>>;
134+
^
135+
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/concepts:63:19: note: because '__detail::__same_as<double (double) noexcept, std::any>' evaluated to false
136+
= __detail::__same_as<_Tp, _Up> && __detail::__same_as<_Up, _Tp>;
137+
^
138+
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/concepts:57:27: note: because 'std::is_same_v<double (double) noexcept, std::any>' evaluated to false
139+
concept __same_as = std::is_same_v<_Tp, _Up>;
140+
^
141+
../../../include/cpp2util.h:2069:16: note: candidate template ignored: constraints not satisfied [with T = int, X = double (&)(double) noexcept]
142+
constexpr auto as( X&& x ) -> decltype(auto) {
143+
^
144+
../../../include/cpp2util.h:2068:22: note: because 'specialization_of_template<double (&)(double) noexcept, std::optional>' evaluated to false
145+
template<typename T, specialization_of_template<std::optional> X>
146+
^
147+
../../../include/cpp2util.h:724:7: note: because 'specialization_of_template_helper<C>(std::forward<X>(x))' would be invalid: no matching function for call to 'specialization_of_template_helper'
148+
{ specialization_of_template_helper<C>(std::forward<X>(x)) } -> std::same_as<std::true_type>;
149+
^
150+
../../../include/cpp2util.h:1813:16: note: candidate function template not viable: requires 0 arguments, but 1 was provided
151+
constexpr auto as() -> auto
152+
^
153+
../../../include/cpp2util.h:1824:16: note: candidate function template not viable: requires 0 arguments, but 1 was provided
154+
constexpr auto as() -> auto
155+
^
156+
pure2-expected-is-as.cpp2:39:37: error: use of undeclared identifier 'ex1'
157+
auto val1 {cpp2::impl::as_<int>(ex1)};
158+
^
159+
pure2-expected-is-as.cpp2:42:29: error: use of undeclared identifier 'ex2'
160+
if (cpp2::impl::is<int>(ex2)) {
161+
^
162+
pure2-expected-is-as.cpp2:47:30: error: use of undeclared identifier 'ex2'
163+
if (cpp2::impl::is<bool>(ex2)) {
164+
^
165+
pure2-expected-is-as.cpp2:52:24: error: use of undeclared identifier 'ex2'
166+
if (cpp2::impl::is(ex2, 123)) {
167+
^
168+
fatal error: too many errors emitted, stopping now [-ferror-limit=]
169+
20 errors generated.
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
pure2-expected-is-as.cpp2:7:10: error: no member named 'expected' in namespace 'std'
2+
std::expected<int,int> ex1 {123};
3+
~~~~~^
4+
pure2-expected-is-as.cpp2:7:22: error: expected '(' for function-style cast or type construction
5+
std::expected<int,int> ex1 {123};
6+
~~~^
7+
pure2-expected-is-as.cpp2:8:10: error: no member named 'expected' in namespace 'std'
8+
std::expected<int,int> ex2 {std::unexpected(-1)};
9+
~~~~~^
10+
pure2-expected-is-as.cpp2:8:22: error: expected '(' for function-style cast or type construction
11+
std::expected<int,int> ex2 {std::unexpected(-1)};
12+
~~~^
13+
pure2-expected-is-as.cpp2:9:10: error: no member named 'expected' in namespace 'std'
14+
std::expected<std::string,size_t> ex3 {"Expect the unexpected"};
15+
~~~~~^
16+
pure2-expected-is-as.cpp2:9:30: error: expected '(' for function-style cast or type construction
17+
std::expected<std::string,size_t> ex3 {"Expect the unexpected"};
18+
~~~~~~~~~~~^
19+
pure2-expected-is-as.cpp2:11:29: error: use of undeclared identifier 'ex1'
20+
if (cpp2::impl::is<int>(ex1)) {
21+
^
22+
pure2-expected-is-as.cpp2:15:30: error: use of undeclared identifier 'ex1'
23+
if (cpp2::impl::is<bool>(ex1)) {
24+
^
25+
pure2-expected-is-as.cpp2:20:30: error: use of undeclared identifier 'ex1'
26+
if (cpp2::impl::is<void>(ex1)) {
27+
^
28+
pure2-expected-is-as.cpp2:25:29: error: no member named 'unexpected' in namespace 'std'
29+
if (cpp2::impl::is<std::unexpected<int>>(ex1)) {
30+
~~~~~^
31+
pure2-expected-is-as.cpp2:25:43: error: expected '(' for function-style cast or type construction
32+
if (cpp2::impl::is<std::unexpected<int>>(ex1)) {
33+
~~~^
34+
pure2-expected-is-as.cpp2:25:46: error: use of undeclared identifier 'ex1'; did you mean 'exp'?
35+
if (cpp2::impl::is<std::unexpected<int>>(ex1)) {
36+
^~~
37+
exp
38+
/usr/lib/llvm-15/bin/../include/c++/v1/math.h:895:1: note: 'exp' declared here
39+
exp(_A1 __lcpp_x) _NOEXCEPT {return ::exp((double)__lcpp_x);}
40+
^
41+
pure2-expected-is-as.cpp2:30:24: error: use of undeclared identifier 'ex1'
42+
if (cpp2::impl::is(ex1, 123)) {
43+
^
44+
pure2-expected-is-as.cpp2:34:24: error: use of undeclared identifier 'ex1'
45+
if (cpp2::impl::is(ex1, 100)) {
46+
^
47+
pure2-expected-is-as.cpp2:39:37: error: use of undeclared identifier 'ex1'
48+
auto val1 {cpp2::impl::as_<int>(ex1)};
49+
^
50+
pure2-expected-is-as.cpp2:42:29: error: use of undeclared identifier 'ex2'
51+
if (cpp2::impl::is<int>(ex2)) {
52+
^
53+
pure2-expected-is-as.cpp2:47:30: error: use of undeclared identifier 'ex2'
54+
if (cpp2::impl::is<bool>(ex2)) {
55+
^
56+
pure2-expected-is-as.cpp2:52:24: error: use of undeclared identifier 'ex2'
57+
if (cpp2::impl::is(ex2, 123)) {
58+
^
59+
pure2-expected-is-as.cpp2:57:29: error: no member named 'unexpected' in namespace 'std'
60+
if (cpp2::impl::is<std::unexpected<int>>(ex2)) {
61+
~~~~~^
62+
fatal error: too many errors emitted, stopping now [-ferror-limit=]
63+
20 errors generated.

0 commit comments

Comments
 (0)