<html>
<head>
<base href="https://bugs.llvm.org/">
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - std::bind presents with #include <string>"
href="https://bugs.llvm.org/show_bug.cgi?id=47806">47806</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>std::bind presents with #include <string>
</td>
</tr>
<tr>
<th>Product</th>
<td>libc++
</td>
</tr>
<tr>
<th>Version</th>
<td>unspecified
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>enhancement
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>Standards Issues
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>yichen.yan@inf.ethz.ch
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org, mclow.lists@gmail.com
</td>
</tr></table>
<p>
<div>
<pre>Created <span class=""><a href="attachment.cgi?id=24048" name="attach_24048" title="test.cc">attachment 24048</a> <a href="attachment.cgi?id=24048&action=edit" title="test.cc">[details]</a></span>
test.cc
for libc++ version >= 7 I got this on Linux:
std::bind will be included if we `#include <string>`
```
root@6a7daac39000:/# /llvm-install/bin/clang++ --version
clang version 12.0.0 (<a href="https://github.com/llvm/llvm-project.git">https://github.com/llvm/llvm-project.git</a>
f2e08c688e6c3223d14c4817c5ce0b55c03a8d1b)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /llvm-install/bin
root@6a7daac39000:/# /llvm-install/bin/clang++ -c -o /dev/null test.cc
test.cc:4:5: warning: expression result unused [-Wunused-value]
(unsigned int) bind(0, 0, 0);
^ ~~~~~~~~~~~~~
test.cc:10:5: warning: expression result unused [-Wunused-value]
(unsigned int) bind(0, 0, 0);
^ ~~~~~~~~~~~~~
2 warnings generated.
root@6a7daac39000:/# /llvm-install/bin/clang++ -c -o /dev/null -stdlib=libc++
test.cc
test.cc:4:5: warning: expression result unused [-Wunused-value]
(unsigned int) bind(0, 0, 0);
^ ~~~~~~~~~~~~~
test.cc:10:5: error: cannot convert '__bind<int, int, int>' to 'unsigned int'
without a conversion operator
(unsigned int) bind(0, 0, 0);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning and 1 error generated.
root@6a7daac39000:/# cat test.cc
#include <sys/socket.h>
void test1() {
// posix bind socket
(unsigned int) bind(0, 0, 0);
}
#include <string>
using namespace std;
void test2() {
// std::bind
(unsigned int) bind(0, 0, 0);
}
```</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>