Issue 132179
Summary [lldb] `operator bool() const` on struct not being resolved in breakpoint condition
Labels new issue
Assignees
Reporter k4lizen
    Using lldb and clang on 01f04252b6711e281d9569172302ec20789e9bbe . Using windows (haven't tried it on linux but I'd assume it reproduces).
```cpp
#include <iostream>

struct Boolish {
    operator bool() const { return false; }
};
int main() {
 Boolish bol;
    if (!(bool)bol) {
        puts("operator resolved correctly!");
    }
    puts("break");
    puts("done");
    return 0;
}
```
Compiling with latest `clang++ main.cpp -g3 -o main.exe`.
Running `./main.exe` gives the expected:
```
operator resolved correctly!
break
done
```
But trying the condition in lldb gives:
```
[snip]
(lldb) breakpoint set -f main.cpp -l 11 --condition "!(bool)bol"
(lldb) run
Process 5476 stopped
* thread #1, stop reason = breakpoint 1.1
    frame #0: 0x00007ff7e3e57186 main.exe`main at main.cpp:52
   49       if (!(bool)bol) {
   50           puts("operator resolved correctly!");
   51       }
-> 52       puts("break");
   53 puts("done");
   54       return 0;
   55   }
error: stopped due to an error evaluating condition of breakpoint 1.1: "!(bool)bol"
Couldn't parse conditional _expression_:
error: Couldn't look up symbols:
  bool Boolish::operator bool(void)
Hint: The _expression_ tried to call a function that is not present in the target, perhaps because it was optimized out by the compiler.

(lldb)
```
If we remove the `const`, everything works as expected.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to