xref: /llvm-project/lldb/test/API/commands/expression/argument_passing_restrictions/main.cpp (revision 99451b4453688a94c6014cac233d371ab4cc342d)
1 // This structure has a non-trivial copy constructor so
2 // it needs to be passed by reference.
3 struct PassByRef {
4   PassByRef() = default;
PassByRefPassByRef5   PassByRef(const PassByRef &p){x = p.x;};
6 
7   int x = 11223344;
8 };
9 
returnPassByRef()10 PassByRef returnPassByRef() { return PassByRef(); }
takePassByRef(PassByRef p)11 int takePassByRef(PassByRef p) {
12     return p.x;
13 }
14 
main()15 int main() {
16     PassByRef p = returnPassByRef();
17     p.x = 42;
18     return takePassByRef(p); // break here
19 }
20