[LLVMbugs] [Bug 11117] New: Link error when using libc++'s std::bind

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Oct 12 04:29:26 PDT 2011


http://llvm.org/bugs/show_bug.cgi?id=11117

           Summary: Link error when using libc++'s std::bind
           Product: clang
           Version: trunk
          Platform: Macintosh
        OS/Version: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++0x
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: jonathan.sauer at gmx.de
                CC: llvmbugs at cs.uiuc.edu, dgregor at apple.com


The following program compiles, but fails to link with clang r141771 and libc++
r141771:

#include <functional>

using namespace std::placeholders;

struct Foo {
    void doItB()
    {
    }
};

template <typename F>
static void bar(F f)
{
    Foo    foo;
    f(foo);
}

int main(int, char**)
{
    bar(std::bind(&Foo::doItB, _1));
}


This results in:

$ ~/LLVM/build/Release+Asserts/bin/clang++ -std=c++0x -stdlib=libc++ -v
clang.cpp 
clang version 3.0 (trunk 141771)
Target: x86_64-apple-darwin10.8.0
Thread model: posix
[...]
Undefined symbols:
 
"__ZNSt3__18__invokeIRM3FooFvvERS1_EEDTdsclsr3std3__1E7forwardIT0_Efp0_Efp_EOT_OS6_",
referenced from:
      __ZL3barINSt3__16__bindIM3FooFvvEJRNS0_12placeholders4__phILi1EEEEEEEvT_
in clang-whLOw0.o
ld: symbol(s) not found
clang: error: linker command failed with exit code 1 (use -v to see invocation)


This error does not occur with clang r140992 (which is why I'm filing this as a
clang bug).

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list