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

#include <cstdlib>
#include <iostream>

main: () -> int = {
    x: int = 42;
    p: *int;

    // ... more code ...
    if std::rand()%2 {
        p = nullptr;
    }
    else {
        p = x&;
    }

    print_and_decorate( p* );
    print_and_decorate( x );
}

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