summaryrefslogtreecommitdiffstats
path: root/lldb/packages/Python/lldbsuite/test/commands/expression/argument_passing_restrictions/main.cpp
blob: 4b3b69504558f638e73ef431bc5d13d64d57dd06 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// This structure has a non-trivial copy constructor so
// it needs to be passed by reference.
struct PassByRef {
  PassByRef() = default;
  PassByRef(const PassByRef &p){x = p.x;};

  int x = 11223344;
};

PassByRef returnPassByRef() { return PassByRef(); }
int takePassByRef(PassByRef p) {
    return p.x;
}

int main() {
    PassByRef p = returnPassByRef();
    p.x = 42;
    return takePassByRef(p); // break here
}
OpenPOWER on IntegriCloud