#include <iostream>
using namespace std;
struct bar {
struct foo {
foo () {
cerr << "foo" << endl;
}
int i = 42;
};
static thread_local foo FOO;
};
static thread_local bar::foo FREE_FOO;
thread_local bar::foo bar::FOO;
int main() {
cerr << "main" << endl;
// cerr << FREE_FOO.i << endl;
cerr << bar::FOO.i << endl;
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgoKdXNpbmcgbmFtZXNwYWNlIHN0ZDsKCnN0cnVjdCBiYXIgewogICAgc3RydWN0IGZvbyB7CiAgICAgICAgZm9vICgpIHsKICAgICAgICAgICAgY2VyciA8PCAiZm9vIiA8PCBlbmRsOwogICAgICAgIH0KICAgICAgICBpbnQgaSA9IDQyOwogICAgfTsKCiAgICBzdGF0aWMgdGhyZWFkX2xvY2FsIGZvbyBGT087Cn07CgpzdGF0aWMgdGhyZWFkX2xvY2FsIGJhcjo6Zm9vIEZSRUVfRk9POwp0aHJlYWRfbG9jYWwgYmFyOjpmb28gYmFyOjpGT087CgppbnQgbWFpbigpIHsKICAgIGNlcnIgPDwgIm1haW4iIDw8IGVuZGw7CiAgICAvLyBjZXJyIDw8IEZSRUVfRk9PLmkgPDwgZW5kbDsKICAgIGNlcnIgPDwgYmFyOjpGT08uaSA8PCBlbmRsOwogICAgcmV0dXJuIDA7Cn0=