https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77998

            Bug ID: 77998
           Summary: clang rejects std::thread from trunk
           Product: gcc
           Version: 7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: trippels at gcc dot gnu.org
  Target Milestone: ---

markus@x4 tmp % cat thread.cpp
#include <thread>
#include <vector>

int main() {
  std::vector<std::thread> threads;
  threads.emplace_back([]() {});
}

markus@x4 tmp % g++ -c thread.cpp
markus@x4 tmp % clang++ -c thread.cpp
In file included from thread.cpp:1:
/usr/lib64/gcc/x86_64-pc-linux-gnu/7.0.0/include/g++-v7/thread:239:39: error:
member access into incomplete type 'std::thread::_Invoker<std::tuple<(lambda at
thread.cpp:6:24)> >'
          = decltype(std::declval<_Invoker>()._M_invoke(_Indices()));
                                             ^
/usr/lib64/gcc/x86_64-pc-linux-gnu/7.0.0/include/g++-v7/thread:126:8: note: in
instantiation of template class 'std::thread::_Invoker<std::tuple<(lambda at
thread.cpp:6:24)> >'
      requested here
              __make_invoker(std::forward<_Callable>(__f),
              ^
/usr/lib64/gcc/x86_64-pc-linux-gnu/7.0.0/include/g++-v7/ext/new_allocator.h:120:23:
note: in instantiation of function template specialization
      'std::thread::thread<(lambda at thread.cpp:6:24)>' requested here
        { ::new((void *)__p) _Up(std::forward<_Args>(__args)...); }
                             ^
/usr/lib64/gcc/x86_64-pc-linux-gnu/7.0.0/include/g++-v7/bits/alloc_traits.h:455:8:
note: in instantiation of function template specialization
      '__gnu_cxx::new_allocator<std::thread>::construct<std::thread, (lambda at
thread.cpp:6:24)>' requested here
        { __a.construct(__p, std::forward<_Args>(__args)...); }
              ^
/usr/lib64/gcc/x86_64-pc-linux-gnu/7.0.0/include/g++-v7/bits/vector.tcc:96:21:
note: in instantiation of function template specialization
      'std::allocator_traits<std::allocator<std::thread>
>::construct<std::thread, (lambda at thread.cpp:6:24)>' requested here
            _Alloc_traits::construct(this->_M_impl, this->_M_impl._M_finish,
                           ^
thread.cpp:6:11: note: in instantiation of function template specialization
'std::vector<std::thread, std::allocator<std::thread> >::emplace_back<(lambda
at thread.cpp:6:24)>'
      requested here
  threads.emplace_back([]() {});
          ^
/usr/lib64/gcc/x86_64-pc-linux-gnu/7.0.0/include/g++-v7/thread:220:14: note:
definition of 'std::thread::_Invoker<std::tuple<(lambda at thread.cpp:6:24)> >'
is not complete until
      the closing '}'
      struct _Invoker
             ^
1 error generated.

Reply via email to