gcc-4.7-20111022 fails to build on PA-RISC

Daniel Krügler daniel.kruegler@googlemail.com
Sun Oct 30 19:23:00 GMT 2011


2011/10/30 Jonathan Wakely <jwakely.gcc@gmail.com>:
> Unfortunately in the real case the initializer is an opaque macro,
> PTHREAD_MUTEX_INITIALIZER, which could be something unsuitable for
> that syntax, such as an integer constant.
>
> The only reliable way to use that macro is:
>
> pthread_mutex_t m = PTHREAD_MUTEX_INITIALIZER;
>
> which requires copy-init.

Here I'm having a logic problem: Obviously the above syntax
is supposed to be well-formed (Let's ignore for the moment
what the macro does). Given that fact, I would argue that
it should also be well-formed as part of any brace-or-equal-initializer
or a non-static data member. Am I missing something here?

What I'm trying to say here is, that if the volatile-member-
and-copy-initialization-semantics reason would be correct,
no-one could portably use

pthread_mutex_t m = PTHREAD_MUTEX_INITIALIZER;

in block scope or namespace scope without creating ill-formed
code. There must be something obvious that I'm failing to see...

Assuming this is indeed a compiler defect in regard to
member initializers I would use your suggestion as a
temporary workaround.

- Daniel



More information about the Libstdc++ mailing list