summaryrefslogtreecommitdiffhomepage
path: root/CompilerDriver/cc2/regression-tests/pure2-bounds-safety-pointer-arithmetic-error.cpp2
blob: b771925028fbcb435c7d481d859781a47e1d87ab (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21

main: () -> int
= {
    words: std::vector<std::string> = ( "decorated", "hello", "world" );

    first: *std::string = words.front()&;
    last : *std::string = words.back()&;

    while first <= last {
        print_and_decorate(first*);
        first++;    // unsafe
        first + 1;
        first[1];
        first~;
        delete first;
    }
}

print_and_decorate: (thing:_) =
    std::cout << ">> " << thing << "\n";