On 03/15/2017 10:49 PM, Jason Merrill wrote:
On Wed, Mar 15, 2017 at 6:59 PM, Martin Sebor <mse...@gmail.com> wrote:
In bug 52477 - Wrong initialization order?  attribute constructor
vs static data access, the reporter expects C++ objects with static
storage duration to have their ctors called in the same order as
those of functions declared with attribute constructor interleaved
with them.

In his comment on the bug Richard opines that relying on the order
is undefined.  The attached patch updates the manual to make this
clear.

I disagree with that comment, and have added one of my own, but I
think your patch is appropriate for GCC 7 since we aren't going to fix
it in this release.

Okay, thanks.  In that case I should probably word it slightly
differently.  I've added "at present" below to imply (hint) that
this might change in the future.  I'll go with this unless you
have a different suggestion.

However, <ins>at present, </ins>the order in which constructors
for C++ objects with static storage duration and functions decorated
with attribute @code{constructor} are invoked is unspecified.  In
mixed declarations, attribute @code{init_priority} can be used to
impose a specific ordering.

Martin

Reply via email to