Issue |
128271
|
Summary |
LLDB uses a wrong object to evaluate an _expression_
|
Labels |
lldb
|
Assignees |
|
Reporter |
igorkudrin
|
When evaluating an _expression_, LLDB can find an object which does not belong to the current context. Here is a reproducer:
```
> cat test.cpp
class Test
{
static const int a[];
};
const int Test::a[] = {1};
int a(int val) { return val; }
int main (int argc, char const *argv[])
{
return a(2); // break here
}
> clang -g test.cpp -o test
> lldb
(lldb) file test
(lldb) br set -p "// break here"
Breakpoint 1: where = test`main + 22 at test.cpp:11:12, address = 0x0000000000001156
(lldb) run
Process 70063 launched: '/tmp/test' (x86_64)
Process 70063 stopped
* thread #1, name = 'test', stop reason = breakpoint 1.1
frame #0: 0x0000555555555156 test`main(argc=1, argv=0x00007fffffffdf08) at test.cpp:11:12
8
9 int main (int argc, char const *argv[])
10 {
-> 11 return a(2); // break here
12 }
(lldb) expr -- a(1)
˄
╰─ error: called object type 'const int[1]' is not a function or function pointer
```
Expected result: the function `a()` must be called; `a[]` should not be visible in this context without explicitly adding `Test::`.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs