summaryrefslogtreecommitdiffhomepage
path: root/CompilerDriver/cc2/regression-tests/mixed-function-expression-with-repeated-capture.cpp2
blob: fbc6582dbf442211e822bc586735f3269b3d1140 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include <vector>
#include <ranges>
#include <string>
#include <span>
#include <algorithm>
#include <iostream>

main: () -> int = {
    vec: std::vector<std::string>
            = ("hello", "2022");

    y := "\n";
    std::ranges::for_each
        ( vec, :(x) = std::cout << y$ << x << y$ );

    callback := :(inout x) = x += "-ish";
    std::ranges::for_each( vec, callback );

    for vec do (str)
        std::cout << str << "\n";
}