From 263915832993dd12beee10e204f9ebcc6c786ed2 Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Sat, 30 Dec 2023 23:39:37 +0100 Subject: Meta: initial commit of WestCo optimized toolchain. Signed-off-by: Amlal El Mahrouss --- ...ed-function-expression-with-pointer-capture.cpp | 44 ++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 CompilerDriver/cc2/regression-tests/test-results/mixed-function-expression-with-pointer-capture.cpp (limited to 'CompilerDriver/cc2/regression-tests/test-results/mixed-function-expression-with-pointer-capture.cpp') 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 +#include +#include +#include +#include +#include + +#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 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"; +} + -- cgit v1.2.3