Prince781 added a comment. The more I think about this, the more I have doubts about whether this should be supported. For example, what happens in cases like this?:
#include <thread> #include <iostream> struct Object { int i; Object() : i(3) {} Object(int v) : i(3 + v) {} }; int main(void) { int w = 4; static thread_local Object o(w); std::cout << "[main] o.i = " << o.i << std::endl; std::thread([] { std::cout << "[new thread] o.i = " << o.i << std::endl; }).join(); } Should `w` be captured or not? Furthermore, if o referenced another block-scope thread-local that had an initializer referencing another local variable, that would have to be captured too. So I now think this should be an error. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D66122/new/ https://reviews.llvm.org/D66122 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits