diff options
Diffstat (limited to 'CompilerDriver/cc2/regression-tests/mixed-function-expression-with-pointer-capture.cpp2')
| -rw-r--r-- | CompilerDriver/cc2/regression-tests/mixed-function-expression-with-pointer-capture.cpp2 | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/CompilerDriver/cc2/regression-tests/mixed-function-expression-with-pointer-capture.cpp2 b/CompilerDriver/cc2/regression-tests/mixed-function-expression-with-pointer-capture.cpp2 new file mode 100644 index 0000000..3d72d7a --- /dev/null +++ b/CompilerDriver/cc2/regression-tests/mixed-function-expression-with-pointer-capture.cpp2 @@ -0,0 +1,22 @@ +#include <vector> +#include <ranges> +#include <string> +#include <span> +#include <algorithm> +#include <iostream> + +main: () -> int = { + vec: std::vector<std::string> + = ("hello", "2023"); + + y: std::string = "\n"; + std::ranges::for_each( vec, :(x) = + std::cout << y&$*.c_str() << x << y&$* + ); + + callback := :(inout x) = x += "-ish"; + std::ranges::for_each( vec, callback ); + + for vec do (str) + std::cout << str << "\n"; +} |
