• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // RUN: %clang %s -g -fexceptions %extra-clang-opts -o %t
2 // RUN: %Test_jit_debuginfo %s %t
3 
4 // If debug info for my_number() is emitted outside function foo's scope
5 // then a debugger may not be able to handle it. At least one version of
6 // gdb crashes in such cases.
7 
8 // DEBUGGER: set breakpoint pending on
9 // DEBUGGER: b nested-struct.cpp:28
10 // DEBUGGER: run
11 // DEBUGGER: ptype foo
12 // CHECK: type = int (void)
13 
foo()14 int foo() {
15   struct Local {
16     static int my_number() {
17       return 42;
18     }
19   };
20 
21   int i = 0;
22   i = Local::my_number();
23   return i + 1;
24 }
25 
main()26 int main() {
27   foo();
28   return 0;
29 }
30