[llvm-bugs] [Bug 39463] New: undefined reference to std::string::empty when using pointer to member

via llvm-bugs llvm-bugs at lists.llvm.org
Sat Oct 27 00:47:50 PDT 2018


https://bugs.llvm.org/show_bug.cgi?id=39463

            Bug ID: 39463
           Summary: undefined reference to std::string::empty when using
                    pointer to member
           Product: clang
           Version: 5.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++11
          Assignee: unassignedclangbugs at nondot.org
          Reporter: rhainin1 at binghamton.edu
                CC: dgregor at apple.com, llvm-bugs at lists.llvm.org

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)

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20181027/af17b7c2/attachment.html>


More information about the llvm-bugs mailing list