[Bug libstdc++/50982] AIX libstdc++ GTHREADS incompatibility
redi at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Sat Nov 5 15:40:00 GMT 2011
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50982
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jason at gcc dot gnu.org
--- Comment #33 from Jonathan Wakely <redi at gcc dot gnu.org> 2011-11-05 15:39:09 UTC ---
Jason, is the compiler right to reject the NSDMI below, and can you suggest any
workaround except using fixincludes to add the missing braces around the
PTHREAD_ONCE_INIT macro for AIX?
The problematic code can be reduced to:
typedef struct
{
int __on_word[28];
}
pthread_once_t;
#define PTHREAD_ONCE_INIT { 0, 0, 0, 0, 0, 0, 0, 2, 0 }
pthread_once_t once = PTHREAD_ONCE_INIT;
struct once_flag
{
private:
pthread_once_t _M_once = PTHREAD_ONCE_INIT;
public:
constexpr once_flag() noexcept = default;
};
once_flag o;
The declaration of "once" at namespace scope only gives warning:
at.cc:9:25: warning: missing braces around initializer for ‘int [28]’
[-Wmissing-braces]
but the same construct used as a NSDMI in once_flag gives an error:
at.cc:14:30: error: array must be initialized with a brace-enclosed initializer
at.cc:14:30: error: too many initializers for ‘pthread_once_t’
More information about the Gcc-bugs
mailing list