fork download
  1. #include <iostream>
  2.  
  3. struct tls {
  4. ~tls() { std::cout << "destroy tls\n"; }
  5. void dont_opt_out() {}
  6. };
  7.  
  8. thread_local tls tls_obj;
  9.  
  10. int main(int argc, char **argv) {
  11. tls_obj.dont_opt_out();
  12. }
  13.  
Success #stdin #stdout 0s 3428KB
stdin
Standard input is empty
stdout
destroy tls