This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/10634] in-class initialization of static data members no longer allowed
- From: "pgonzalez at bluel dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 7 May 2004 11:54:02 -0000
- Subject: [Bug c++/10634] in-class initialization of static data members no longer allowed
- References: <20030506010600.10634.pgonzalez@bluel.com>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From pgonzalez at bluel dot com 2004-05-07 11:53 -------
(In reply to comment #6)
> I personally believe we should stick with our present behavior. We have
> had pretty widely distributed releases 3.2.3 and 3.3.x in between, and
> have not gotten many reports about this. It seems absurd to go back in
> 3.4.1 or 3.5.0 to allow behavior that
I originally solved the problem simply by moving the definition to the
.cpp file. However, in that case the constant address can no longer be
expanded inline and is replaced with an external reference. For
frequently used symbols, this results in extra assembly instructions
and extra register allocations. (I encountered the problem with some
highly optimized code for tracing callstacks, i.e. it was called
by __cyg_profile_func_enter() for every single function.) Also, it
just seems strange to treat "integral" types specially in this context.
If someone thinks these issues might be generally relevant, let me know
and I'll look into the items requested by Giovanni Bajo. Otherwise, the
patch is here if you want it.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=10634