[cfe-dev] Crash with stdlibc++ but not with libc++

Ryan Prichard ryan.prichard at gmail.com
Sat Jan 5 18:13:03 PST 2013


On 01/03/2013 01:29 PM, Navreet Gill wrote:
> 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 <thread>
> #include <iostream>
>
> 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:

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




More information about the cfe-dev mailing list