[Bug c++/81880] thread_local static member template initialisation fails

latimerius at seznam dot cz gcc-bugzilla@gcc.gnu.org
Tue Sep 18 09:32:00 GMT 2018


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81880

Latimerius <latimerius at seznam dot cz> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |latimerius at seznam dot cz

--- Comment #2 from Latimerius <latimerius at seznam dot cz> ---
This bug still seems to exist in the current 9.0 HEAD.  Note also that another
possible work-around might be to wrap the thread_local member in an accessor
function, along the lines of

class A {
public:
  template<typename T>
  std::unordered_map<int,T> & get_m ()
  {
    thread_local static std::unordered_map<int,T> m;
    return m;
  }
};


More information about the Gcc-bugs mailing list