summaryrefslogtreecommitdiffhomepage
path: root/CompilerDriver/cc2/regression-tests/mixed-lifetime-safety-pointer-init-2-error.cpp2
blob: b3bfec858eedc82fe08fd8b7f8ecb01ee153ac0e (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";