diff options
| author | Amlal El Mahrouss <amlal.elmahrouss@icloud.com> | 2023-12-30 23:39:37 +0100 |
|---|---|---|
| committer | Amlal El Mahrouss <amlal.elmahrouss@icloud.com> | 2023-12-30 23:39:37 +0100 |
| commit | 263915832993dd12beee10e204f9ebcc6c786ed2 (patch) | |
| tree | 862e51208a99c35746e574a76564a4532b3a4a49 /CompilerDriver/cc2/regression-tests/test-results/mixed-function-expression-with-pointer-capture.cpp | |
Meta: initial commit of WestCo optimized toolchain.
Signed-off-by: Amlal El Mahrouss <amlal.elmahrouss@icloud.com>
Diffstat (limited to 'CompilerDriver/cc2/regression-tests/test-results/mixed-function-expression-with-pointer-capture.cpp')
| -rw-r--r-- | CompilerDriver/cc2/regression-tests/test-results/mixed-function-expression-with-pointer-capture.cpp | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/CompilerDriver/cc2/regression-tests/test-results/mixed-function-expression-with-pointer-capture.cpp b/CompilerDriver/cc2/regression-tests/test-results/mixed-function-expression-with-pointer-capture.cpp new file mode 100644 index 0000000..9d5b37d --- /dev/null +++ b/CompilerDriver/cc2/regression-tests/test-results/mixed-function-expression-with-pointer-capture.cpp @@ -0,0 +1,44 @@ + + +//=== Cpp2 type declarations ==================================================== + + +#include "cpp2util.h" + +#line 1 "mixed-function-expression-with-pointer-capture.cpp2" + + +//=== Cpp2 type definitions and function declarations =========================== + +#line 1 "mixed-function-expression-with-pointer-capture.cpp2" +#include <vector> +#include <ranges> +#include <string> +#include <span> +#include <algorithm> +#include <iostream> + +#line 8 "mixed-function-expression-with-pointer-capture.cpp2" +[[nodiscard]] auto main() -> int; + +//=== Cpp2 function definitions ================================================= + +#line 1 "mixed-function-expression-with-pointer-capture.cpp2" + +#line 8 "mixed-function-expression-with-pointer-capture.cpp2" +[[nodiscard]] auto main() -> int{ + std::vector<std::string> vec { + "hello", "2023"}; + + std::string y {"\n"}; + std::ranges::for_each(vec, [_0 = (&y)](auto const& x) mutable -> void { + std::cout << CPP2_UFCS(c_str)((*cpp2::assert_not_null(_0))) << x << *cpp2::assert_not_null(_0); } + ); + + auto callback {[](auto& x) mutable -> void { x += "-ish"; }}; + std::ranges::for_each(vec, std::move(callback)); + + for ( auto const& str : vec ) + std::cout << str << "\n"; +} + |
