The warning tells you that the first line in your try block is parsed as a function declaration. This sometimes happens if you use the C ++ 03 initialization style. Instead, use uniform initialization:
scoped_thread t{std::thread{local_functor{some_local_state}}};
In addition, the scoped_thread constructor lacks & :
explicit scoped_thread(std::thread && t): t_(std::move(t))
PS: If your compiler does not support uniform initialization, wrap the initializer in another pair of brackets: scoped_thread t((std::thread(local_functor(some_local_state))));
source share