summaryrefslogtreecommitdiffhomepage
path: root/CompilerDriver/cc2/regression-tests/mixed-parameter-passing.cpp2
blob: 1ebc595a8304264fbacb2507777fcfb5f479c0eb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40

#include <string>
#include <cstdlib>
#include <ctime>

copy_from: (copy _) = { }

parameter_styles: (
    in    _: std::string, // "in" is default
    copy  b: std::string,
    inout _: std::string,
    move  d: std::string
    )
= {
    z: int = 12;

    z++;
    b += "plugh";

    if std::rand()%2 {
        z++;
        copy_from(b);   // definite last use
    }
    else {
        copy_from(b&);  // NB: better not move from this (why not?)
        copy_from(d);
        copy_from(z++);
    }

    // std::move(z);

    copy_from(z);

    if std::time(nullptr)%2 == 0 {
        copy_from(z);
    }

}

main: () -> int = { }