xref: /llvm-project/lldb/test/API/commands/frame/diagnose/bad-reference/main.cpp (revision 99451b4453688a94c6014cac233d371ab4cc342d)
1 struct Bar {
2   int c;
3   int d;
4 };
5 
6 struct Foo {
7   int a;
8   struct Bar &b;
9 };
10 
GetAFoo()11 struct Foo *GetAFoo() {
12   static struct Foo f = { 0, *((Bar*)0) };
13   return &f;
14 }
15 
GetSum(struct Foo * f)16 int GetSum(struct Foo *f) {
17   return f->a + f->b.d;
18 }
19 
main()20 int main() {
21   return GetSum(GetAFoo());
22 }
23