[Bug c++/47861] static variables inside member functions

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Feb 23 22:09:00 GMT 2011


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47861

--- Comment #6 from Jonathan Wakely <redi at gcc dot gnu.org> 2011-02-23 21:28:10 UTC ---
(In reply to comment #5)
> Also it is hard to produce a warning when it comes to a failure that will only
> be diagnostic at link time.

IIUC I think the OP wants a warning for:

struct S {
  int f();
};

int S::f() {
  static int i = 0;
  return ++i;
}

which doesn't require a definition and can't produce a linker error.  I think
adding a warning for this is silly.



More information about the Gcc-bugs mailing list