Skip to content

Commit 6459997

Browse files
committed
fix(cpp14): replace d2x.harness with d2x in 00-generic-lambdas exercise
1 parent 252a11b commit 6459997

2 files changed

Lines changed: 51 additions & 1 deletion

File tree

.d2x/last-output.log

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
/home/lcz/dev_version/d2mcpp/src/cpp14/tests/00-generic-lambdas/0.cpp: In function 'int main()':
2+
/home/lcz/dev_version/d2mcpp/src/cpp14/tests/00-generic-lambdas/0.cpp:28:24: error: 'D2X_YOUR_ANSWER' has not been declared
3+
28 | auto identity = [](D2X_YOUR_ANSWER x) {
4+
| ^~~~~~~~~~~~~~~
5+
/home/lcz/dev_version/d2mcpp/src/cpp14/tests/00-generic-lambdas/0.cpp:33:24: error: no match for call to '(main()::<lambda(int)>) (std::string)'
6+
33 | d2x::check(identity(std::string("hello")) == "hello", "identity(std::string(\"hello\")) == \"hello\"");
7+
| ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
8+
• there are 2 candidates
9+
/home/lcz/dev_version/d2mcpp/src/cpp14/tests/00-generic-lambdas/0.cpp:28:22:
10+
28 | auto identity = [](D2X_YOUR_ANSWER x) {
11+
| ^
12+
• candidate 1: 'int (*)(int)' (conversion)
13+
/home/lcz/dev_version/d2mcpp/src/cpp14/tests/00-generic-lambdas/0.cpp:33:24:
14+
33 | d2x::check(identity(std::string("hello")) == "hello", "identity(std::string(\"hello\")) == \"hello\"");
15+
| ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
16+
• candidate expects 2 arguments, 2 provided
17+
• candidate 2: 'main()::<lambda(int)>'
18+
/home/lcz/dev_version/d2mcpp/src/cpp14/tests/00-generic-lambdas/0.cpp:28:21:
19+
28 | auto identity = [](D2X_YOUR_ANSWER x) {
20+
| ^
21+
• no known conversion for argument 1 from 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'int'
22+
/home/lcz/dev_version/d2mcpp/src/cpp14/tests/00-generic-lambdas/0.cpp:34:35: error: 'D2X_YOUR_ANSWER' was not declared in this scope
23+
34 | d2x::check_eq(identity(3.14), D2X_YOUR_ANSWER, "identity(3.14) == D2X_YOUR_ANSWER");
24+
| ^~~~~~~~~~~~~~~
25+
/home/lcz/dev_version/d2mcpp/src/cpp14/tests/00-generic-lambdas/0.cpp: In lambda function:
26+
/home/lcz/dev_version/d2mcpp/src/cpp14/tests/00-generic-lambdas/0.cpp:38:16: error: 'D2X_YOUR_ANSWER' is not captured [-Wtemplate-body]
27+
38 | return D2X_YOUR_ANSWER;
28+
| ^~~~~~~~~~~~~~~
29+
/home/lcz/dev_version/d2mcpp/src/cpp14/tests/00-generic-lambdas/0.cpp:37:21: note: the lambda has no capture-default
30+
37 | auto greater = [](auto a, auto b) {
31+
| ^
32+
/home/lcz/dev_version/d2mcpp/src/cpp14/tests/00-generic-lambdas/0.cpp:34:35: note: '<typeprefixerror>D2X_YOUR_ANSWER' declared here
33+
34 | d2x::check_eq(identity(3.14), D2X_YOUR_ANSWER, "identity(3.14) == D2X_YOUR_ANSWER");
34+
| ^~~~~~~~~~~~~~~
35+
/home/lcz/dev_version/d2mcpp/src/cpp14/tests/00-generic-lambdas/0.cpp: In function 'int main()':
36+
/home/lcz/dev_version/d2mcpp/src/cpp14/tests/00-generic-lambdas/0.cpp:41:23: error: invalid use of void expression
37+
41 | d2x::check(greater(5, 3), "greater(5, 3)");
38+
| ~~~~~~~^~~~~~
39+
/home/lcz/dev_version/d2mcpp/src/cpp14/tests/00-generic-lambdas/0.cpp:42:23: error: invalid use of void expression
40+
42 | d2x::check(greater(2.5, 1.2), "greater(2.5, 1.2)");
41+
| ~~~~~~~^~~~~~~~~~
42+
/home/lcz/dev_version/d2mcpp/src/cpp14/tests/00-generic-lambdas/0.cpp:43:23: error: invalid use of void expression
43+
43 | d2x::check(greater(std::string("z"), std::string("a")), "greater(std::string(\"z\"), std::string(\"a\"))");
44+
| ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
45+
/home/lcz/dev_version/d2mcpp/src/cpp14/tests/00-generic-lambdas/0.cpp:50:32: error: invalid use of void expression
46+
50 | d2x::check_eq(get_type_size(42), sizeof(int), "get_type_size(42) == sizeof(int)");
47+
| ~~~~~~~~~~~~~^~~~
48+
/home/lcz/dev_version/d2mcpp/src/cpp14/tests/00-generic-lambdas/0.cpp:51:32: error: invalid use of void expression
49+
51 | d2x::check_eq(get_type_size('c'), sizeof(char), "get_type_size('c') == sizeof(char)");
50+
| ~~~~~~~~~~~~~^~~~~

src/cpp14/tests/00-generic-lambdas/0.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
//
2121

2222
import std;
23-
import d2x.harness;
23+
import d2x;
2424

2525
int main() {
2626

0 commit comments

Comments
 (0)