[Bug c++/47453] Various non-conforming behaviors with braced-init-list initialization
schaub.johannes at googlemail dot com
gcc-bugzilla@gcc.gnu.org
Fri Jul 29 12:24:00 GMT 2011
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47453
--- Comment #5 from Johannes Schaub <schaub.johannes at googlemail dot com> 2011-07-29 12:23:35 UTC ---
(In reply to comment #4)
> struct A { int a[2]; A():a({1, 2}) { } };
>
> Should be valid. Example:
>
> class cond_variable
> {
> ::pthread_cond_t cond;
> public:
> constexpr cond_variable() : cond(PTHREAD_COND_INITIALIZER) {}
> };
>
> What is pthread_cond_t? Struct? Array? Scalar? How I can be sure this code is
> accepted in any case? Uniform initialization initially address this issue.
>
Why not say
constexpr cond_variable() : cond PTHREAD_COND_INITIALIZER { }
> Out of constructor one can use "=":
>
> ::pthread_cond_t cond = PTHREAD_COND_INITIALIZER;
>
You can define it as follows to make it work in both cases
#define PTHREAD_COND_INITIALIZER {}
More information about the Gcc-bugs
mailing list