https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83568
--- Comment #1 from Kan Wang <tinrow at gmail dot com> ---
Sorry for wrong paste, the code should be
#include <iostream>
bool initialized = false;
int init() {
initialized = true;
return 1;
}
struct A {
static thread_local int foo;
};
thread_local int A::foo { init() };
int main() {
A a;
std::cout << a.foo << std::endl;
std::cout << (initialized ? "ok" : "bug" ) << std::endl;
std::cout << A::foo << std::endl;
return 0;
}
Output:
0
bug
1
