[Bug c++/68784] deductible parameter type still requires explicit reference cast, e.g., std::thread

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Dec 8 11:28:00 GMT 2015


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

--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Wang Xuancong from comment #0)
> g++ require explicit reference cast:
> t[0] = thread(thread_add, ref(ht), 0, 9);

With that change your program has a data race due to modifying the same object
in two separate threads, which leads to undefined behaviour. You should get a
good book and read it carefully.


More information about the Gcc-bugs mailing list