This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/49311] Missing static const symbol with -O0


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

--- Comment #5 from Hartmut Schirmer <hartmut.schirmer at arcormail dot de> 2011-06-08 05:25:44 UTC ---
> I think there are several hundred already.

Oh, this list was helpful, thanks!

> Not worth marking them as duplicate,
> it just further upsets people receiving notifications for a problem that has no
> solution.

Looking at http://www2.research.att.com/~bs/bs_faq2.html#in-class I found this

  "You can take the address of a static member if (and only if) it has an
out-of-class definition"

Of course this is not a promise you don't need an out-of-class definition if
you don't take the address. Gcc uses the assumption it can take the address in
-O0 mode, but is this assumption justified? It's at least surprising.

class A
{
public:
  static const unsigned first = 1;
  enum { second = 2 };
};

should behave similar in all cases address of first isn't taken.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]