https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84532
Bug ID: 84532 Summary: [7/8 Regression] std::thread::__make_invoker prematurely unwraps reference_wrappers Product: gcc Version: 8.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: rs2740 at gmail dot com Target Milestone: --- std::thread::__make_invoker uses make_tuple, which unwraps reference_wrappers, so instead of passing a DECAY_COPY'd reference_wrapper<T> rvalue to __invoke, it (incorrectly) passes a T lvalue instead. This means that we accept invalid code like int i = 0; std::thread t([](auto&){}, std::ref(i)); It's not too hard to come up with code that changes meaning and valid code that gets rejected either. This is a 7/8 regression: previously the now-removed __bind_simple was used, which correctly just does a simple decay.