http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50982

--- Comment #24 from Jonathan Wakely <redi at gcc dot gnu.org> 2011-11-05 
12:23:45 UTC ---
(In reply to comment #23)
> I suspect that libstdc++ is having problems because pthread_once_t is a struct
> in AIX.  libstdc++ should not be written to assume it is a scalar.

Ah, that's easily fixed, std::once_flag should use a non-static data member
initializer, does this patch help:

Index: include/std/mutex
===================================================================
--- include/std/mutex   (revision 180447)
+++ include/std/mutex   (working copy)
@@ -760,11 +760,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
   {
   private:
     typedef __gthread_once_t __native_type;
-    __native_type  _M_once;
+    __native_type  _M_once = __GTHREAD_ONCE_INIT;

   public:
     /// Constructor
-    constexpr once_flag() noexcept : _M_once(__GTHREAD_ONCE_INIT) { }
+    constexpr once_flag() noexcept = default;

     /// Deleted copy constructor
     once_flag(const once_flag&) = delete;

Reply via email to