<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 - undefined reference to std::string::empty when using pointer to member"
href="https://bugs.llvm.org/show_bug.cgi?id=39463">39463</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>undefined reference to std::string::empty when using pointer to member
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>5.0
</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>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>C++11
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>rhainin1@binghamton.edu
</td>
</tr>
<tr>
<th>CC</th>
<td>dgregor@apple.com, llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>Creating a pointer to member of a std::string with clang 5.0 and 6.0 is failing
for me with libc++. I've tried to repro this with something not using
std::string but can't, a similar attempt with std::vector<int> doesn't produce
the error.
#### Code ####
#include <string>
int main() {
auto f = &std::string::empty;
}
#### Error message ####
$ clang++-5.0 -std=c++11 -pedantic -stdlib=libc++ main.cpp
/tmp/main-f98c37.o: In function `main':
main.cpp:(.text+0x12): undefined reference to `std::__1::basic_string<char,
std::__1::char_traits<char>, std::__1::allocator<char> >::empty() const'
/usr/bin/ld: a.out: hidden symbol
`_ZNKSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE5emptyEv'
isn't defined
/usr/bin/ld: final link failed: Bad value
clang: error: linker command failed with exit code 1 (use -v to see invocation)</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>