On Fri, May 31, 2019 at 12:16:58PM -0400, Marek Polacek wrote:
> > The warning is not meant to diagnose these.  But I do agree that the
> > documentation for the new warning should be improved.
> 
> I was partially wrong: if i/j are at file scope, then the warning triggers.
> But if i/j are in a function, then it doesn't warn.

That is correct, because the block scope statics aren't actually initialized
from a global constructor, but with a guard variable whenever a function is
called the first time.  So on
int bar ();
struct S { S (); ~S (); };

void
foo ()
{
  static int a = bar ();
  static S s;
}
this warning shouldn't warn at all.  It might be useful to have another
warning for these, but it should be a different warning.

        Jakub

Reply via email to