Crash with stdlibc++ but not with libc++

Not sure where to report this… so I apologize if this is not the right place.

When I build and run this simple program with gcc, it works. It also works with clang and libc++, but it fails with clang and stdlibc++. Is clang + stdlibc++ a supported combination?

#include
#include

int main()
{
auto hello_world = () { std::cout << “Hello world” << std::endl; };

std::thread thr(hello_world);
thr.join();

return 0;
}

$ g++ -std=c++11 hw.cpp -lpthread && ./a.out
Hello world

$ clang++ -stdlib=libc++ -std=c++11 hw.cpp -lpthread && ./a.out
Hello world

$ clang++ -std=c++11 hw.cpp -lpthread && ./a.out

pure virtual method called
terminate called without an active exception
Aborted (core dumped)

I am on Ubuntu 12.10 with a PPA that built clang 3.2, here are my paths:

$ clang++ -std=c++11 -v -x c++ /dev/null -fsyntax-only

Ubuntu clang version 3.2-9 (tags/RELEASE_32/final) (based on LLVM 3.2)

Target: x86_64-pc-linux-gnu

Thread model: posix

“/usr/bin/clang” -cc1 -triple x86_64-pc-linux-gnu -fsyntax-only -disable-free -disable-llvm-verifier -main-file-name null -mrelocation-model static -mdisable-fp-elim -fmath-errno -masm-verbose -mconstructor-aliases -munwind-tables -fuse-init-array -target-cpu x86-64 -target-linker-version 2.22.90.20120924 -momit-leaf-frame-pointer -v -resource-dir /usr/bin/…/lib/clang/3.2 -fmodule-cache-path /var/tmp/clang-module-cache -internal-isystem /usr/bin/…/lib/gcc/x86_64-linux-gnu/4.7/…/…/…/…/include/c++/4.7 -internal-isystem /usr/bin/…/lib/gcc/x86_64-linux-gnu/4.7/…/…/…/…/include/c++/4.7/x86_64-linux-gnu -internal-isystem /usr/bin/…/lib/gcc/x86_64-linux-gnu/4.7/…/…/…/…/include/c++/4.7/backward -internal-isystem /usr/bin/…/lib/gcc/x86_64-linux-gnu/4.7/…/…/…/…/include/c++ -internal-isystem /usr/bin/…/lib/gcc/x86_64-linux-gnu/4.7/…/…/…/…/include/c++/x86_64-linux-gnu -internal-isystem /usr/bin/…/lib/gcc/x86_64-linux-gnu/4.7/…/…/…/…/include/c++/backward -internal-isystem /usr/local/include -internal-isystem /usr/bin/…/lib/clang/3.2/include -internal-isystem /usr/include/clang/3.2/include/ -internal-externc-isystem -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /usr/include -std=c++11 -fdeprecated-macro -fdebug-compilation-dir /home/buildbot/Code/disruptor/disruptor–/test/test -ferror-limit 19 -fmessage-length 316 -mstackrealign -fobjc-runtime=gcc -fcxx-exceptions -fexceptions -fdiagnostics-show-option -fcolor-diagnostics -x c++ /dev/null

clang -cc1 version 3.2 based upon LLVM 3.2svn default target x86_64-pc-linux-gnu

ignoring nonexistent directory “/usr/bin/…/lib/gcc/x86_64-linux-gnu/4.7/…/…/…/…/include/c++/x86_64-linux-gnu”

ignoring nonexistent directory “/usr/bin/…/lib/gcc/x86_64-linux-gnu/4.7/…/…/…/…/include/c++/backward”

ignoring nonexistent directory “/usr/bin/…/lib/clang/3.2/include”

ignoring nonexistent directory “”

ignoring duplicate directory “/usr/include/x86_64-linux-gnu”

#include “…” search starts here:

#include <…> search starts here:

/usr/bin/…/lib/gcc/x86_64-linux-gnu/4.7/…/…/…/…/include/c++/4.7

/usr/bin/…/lib/gcc/x86_64-linux-gnu/4.7/…/…/…/…/include/c++/4.7/x86_64-linux-gnu

/usr/bin/…/lib/gcc/x86_64-linux-gnu/4.7/…/…/…/…/include/c++/4.7/backward

/usr/bin/…/lib/gcc/x86_64-linux-gnu/4.7/…/…/…/…/include/c++

/usr/local/include

/usr/include/clang/3.2/include

/usr/include/x86_64-linux-gnu

/usr/include

End of search list.

This problem is http://llvm.org/bugs/show_bug.cgi?id=12730. I think I know what's going wrong; I commented on the issue.

-Ryan