efriedma added a comment. > If variable A's initializer references variable B, then it will call B's > initializer.
I'm considering a testcase like this: struct S { int x; }; void bar(S**); void baz(void()); void f() { thread_local S s = {1}; thread_local S* p = &s; baz([]{bar(&p);}); } The initializer for `p` normally just assumes `s` is initialized. I don't think this patch adds any code that would address that, although I could be missing something. -------- Thinking about it a bit more, I also have a general question: how is this supposed to work? What do other compilers do? Does the C++ standard say when the initializer is supposed to run? [stmt.dcl]p4 just says "Dynamic initialization [...] is performed the first time control passes through its declaration." 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