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

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

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

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

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