[Bug c++/27557] OpenMP threadprivate directive does not work with non-POD types

2021-04-16 Thread jcownie at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=27557

--- Comment #21 from Jim Cownie  ---
Thanks for the workaround, Jakub; it's somewhat perverse, but better than the
alternatives!

[Bug c++/27557] OpenMP threadprivate directive does not work with non-POD types

2021-04-16 Thread jcownie at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=27557

Jim Cownie  changed:

   What|Removed |Added

 CC||jcownie at gmail dot com

--- Comment #19 from Jim Cownie  ---
The OpenMP aspect of this is still present in GCC 10, so this bug has beena
round for almost *15 years*!
Other compilers (LLVM, Intel, ...) happily compile such code. 

Given that the underlying mechanisms now exist, a fix for the OpenMP aspect
really shouldn't be too hard, should it?

I really don't want to have to write

#if (__GNUC__)
  // Work around GCC bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=27557
  // (Scroll near the end...)
  static thread_local fileStats threadRes;
#else
  static fileStats threadRes;
#pragma omp threadprivate (threadRes)
#endif

in all of my code examples and blog posts, since it just makes GCC look poor.