http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57716
Bug ID: 57716 Summary: std::thread does not compile with vector<int>& as argument Product: gcc Version: 4.8.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: felix-gcc at fefe dot de When trying out the std::thread support in g++ 4.8.1, I tried this test program: #include <thread> #include <vector> using namespace std; void thethread(vector<int>& b) { // do something } int main() { vector<int> x { 1,2,3 }; thethread(x); // works thread foo(thethread,x); // compiler error foo.join(); } calling the thread directly works, but doing it via the thread initialization fails with this error message: In file included from /usr/include/c++/4.8.1/thread:39:0, from t.cc:1: /usr/include/c++/4.8.1/functional: In instantiation of ‘struct std::_Bind_simple<void (*(std::vector<int>))(std::vector<int>&)>’: /usr/include/c++/4.8.1/thread:137:47: required from ‘std::thread::thread(_Callable&&, _Args&& ...) [with _Callable = void (&)(std::vector<int>&); _Args = {std::vector<int, std::allocator<int> >&}]’ t.cc:13:25: required from here /usr/include/c++/4.8.1/functional:1697:61: error: no type named ‘type’ in ‘class std::result_of<void (*(std::vector<int>))(std::vector<int>&)>’ typedef typename result_of<_Callable(_Args...)>::type result_type; ^ /usr/include/c++/4.8.1/functional:1727:9: error: no type named ‘type’ in ‘class std::result_of<void (*(std::vector<int>))(std::vector<int>&)>’ _M_invoke(_Index_tuple<_Indices...>) ^ I also tried 4.8.0, same issue. A fried tried this with g++ 4.6.3 and it worked there, so it appears to be a regression. Or maybe Ubuntu fixed something in their branch of g++. I'm using stock gcc, the friend tried the gcc from Ubuntu 12.04. Note that the issue goes away if I change the function to take a pointer instead of a reference to a vector<int>.