<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/57867>57867</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
LLDB target.import-std-module true causes false ambiguity errors
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
rnikander
</td>
</tr>
</table>
<pre>
Example:
```
#include <fstream>
#include <iostream>
int main() {
std::ifstream fout("/tmp/junk");
bool b = fout.is_open();
std::cout << "is_open? " << b << std::endl;
return 0;
}
```
Following the answer [here](https://stackoverflow.com/questions/70445481/error-couldnt-lookup-symbols-when-calling-an-stl-method-in-lldb) about having STL symbols available when debugging, I add this line to ~/.lldbinit:
```
settings set target.import-std-module true
```
Then compile and debug...
```
% clang++ -std=c++20 -g -O0 amg2.cc
% lldb a.out
(lldb) target create "a.out"
Current executable set to '/Users/rob/Workspace/BugsAndQuestions/LLDB/a.out' (x86_64).
(lldb) break set --file amg2.cc --line 8
Breakpoint 1: where = a.out`main + 192 at amg2.cc:8:3, address = 0x0000000100002d50
(lldb) run
Process 1774 launched: '/Users/.../a.out' (x86_64)
is_open? 0
Process 1774 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = breakpoint 1.1
frame #0: 0x0000000100002d50 a.out`main at amg2.cc:8:3
5 std::ifstream fout("/tmp/junk");
6 bool b = fout.is_open();
7 std::cout << "is_open? " << b << std::endl;
-> 8 return 0;
9 }
Target 0: (a.out) stopped.
(lldb) po fout.is_open()
error: expression failed to parse:
error: <user expression 0>:1:6: call to member function 'is_open' is ambiguous
fout.is_open()
~~~~~^~~~~~~
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/fstream:1169:10: candidate function
bool is_open() const;
^
note: candidate function
(lldb)
```
Versions:
```
% clang --version
Apple clang version 14.0.0 (clang-1400.0.29.102)
Target: x86_64-apple-darwin22.1.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
% lldb --version
lldb-1400.0.30.3
Apple Swift version 5.7 (swiftlang-5.7.0.127.4 clang-1400.0.29.50)
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJytVm1zozYQ_jX4iwZGgDH4gz84cTxz0-vcdZJr79uNgMXmIhCVhJP7990VL3HsXNppmyFYSKt907PPKlflj83ds2g6CV689fjO49N7xcdn-Iziui1kXwLz4tvKWA2i8eK7t1Zrdbns3nVrWSPq1osyL1ozL70Z5hkztiTr8bYeFbNK9dbJRV60t02H7-99--i-114878yVkixHozu3JajNN9XBaOJMbrZQoBT5iA9DbZN8vKevaSGfBvM2aEt5pk6D7XXL-Dzlpbu30-beeyWleqrbA7NHYKI1T6CZl9wcQYOX7NDbo7WdIVPRHh9jRfGoTqAr3BYUqsG5P3swtlatwXHKl8tkmYU4BK2V9jEqWbbWl0o99p1vfjS5ksZ_OkLrF0JKNO2L1jdW-g3Yoyr9uvWlLHM6CJFTTo7iRA7eP3xk43YmTqKWIpfASBErIe8PBxTyolv2gYmyxHBqw1A7MKvwQO_QoYDU1m1t38eTAWtRlWE4YFboA-DhNZ3SFr0s_UaVPdq1uod38vpAbmF6ulpSWsvBxSAI3gVywgopKIobfJjvznhXDJ8RZ_6B-Z84E80hCoriZRPFxURAuXr7bxLNpsQOYbECEW2B8OV2E4ad5G2vNWBNwDMUvXV5dsnATEYpZvKLAU2nrRVq2_-h9KPpRAE4vukPZtuWv51B4uPHHfq_Hy2kqCJ7zlbfVkt0JLjyLEeXHp01369c8oZo8dOdZjbsuCGxTlHhhnicBAMNrtgGOytO9cwojeE6YsLOWYu3Gf7HhBTEiQZj3Db-zIe_kF5RmfAr13TfDnOftSpoX5imSyZF3xZHoGq8yA6d9k_iHmnnpcT5G5qNVV2Hikc_tohpjLpERXFI7mPd9UPMqB6xFogOyTKgwP1B1Plz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