[PATCH] D66122: [CodeGen] Emit dynamic initializers for static TLS vars in outlined scopes
Princeton Ferro via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Aug 22 07:56:44 PDT 2019
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
More information about the cfe-commits
mailing list