This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: glibc test tst-thread_local1.cc fails to compile with latest GCC


On 19 October 2016 at 18:45, Ellcey, Steve wrote:
> I have built the latest glibc sources with a ToT GCC and am trying to run the glibc testsuite now.  I ran into a couple of
> new warnings that I fixed (locally) and am now looking at nptl/tst-thread_local1.cc which dies with:
>
> tst-thread_local1.cc:172:7: error: ‘thread’ is not a member of ‘std’
>        std::thread thr{[func] {func (nullptr);}};
>
> Does anyone know what is going on here?  If I compile a small test program:
>
> #include <thread>
> int main(int, char **){
>     std::thread tt;
> }
>
> With G++ 5.4 (using -std=c++11) this test program compiles. but with ToT GCC, it dies with:
>
> g++ -std=c++11 thread.cc -lpthread -o x
> thread.cc: In function ‘int main(int, char**)’:
> thread.cc:5:5: error: ‘thread’ is not a member of ‘std’
>      std::thread tt;
>      ^~~
> thread.cc:5:5: note: suggested alternative: ‘fread’
>      std::thread tt;
>      ^~~
>      fread
>
>
> Is there some C++ standard change that I am not aware of or some other header file I need to include?

No, what probably happened is GCC didn't detect a usable Pthreads
implementation and so doesn't define std::thread. The <thread> header
uses this condition around the definition of std::thread:

#if defined(_GLIBCXX_HAS_GTHREADS) && defined(_GLIBCXX_USE_C99_STDINT_TR1)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]