| 1 | #include "ns.h" |
|---|---|
| 2 | |
| 3 | int foo() |
| 4 | { |
| 5 | std::printf(format: "global foo()\n"); |
| 6 | return 42; |
| 7 | } |
| 8 | int func() |
| 9 | { |
| 10 | std::printf(format: "global func()\n"); |
| 11 | return 1; |
| 12 | } |
| 13 | int func(int a) |
| 14 | { |
| 15 | std::printf(format: "global func(int)\n"); |
| 16 | return a + 1; |
| 17 | } |
| 18 | void test_lookup_at_global_scope() |
| 19 | { |
| 20 | // BP_global_scope |
| 21 | std::printf(format: "at global scope: foo() = %d\n", foo()); // eval foo(), exp: 42 |
| 22 | std::printf(format: "at global scope: func() = %d\n", func()); // eval func(), exp: 1 |
| 23 | } |
| 24 |
