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