This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/31904] fail to link to static const double
- From: "fang at csl dot cornell dot edu" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 12 May 2007 16:53:12 -0000
- Subject: [Bug c++/31904] fail to link to static const double
- References: <bug-31904-14536@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #7 from fang at csl dot cornell dot edu 2007-05-12 17:53 -------
Subject: Re: fail to link to static const double
> ------- Comment #6 from dennis0yang at gmail dot com 2007-05-12 17:19 -------
> Subject: Re: fail to link to static const double
>
> I understand perfectly well everything you said. But I think you miss
> the point of this bug report.
> This is not about the c++ standard in terms of what should and should
> not be done. This is about get rid of the "luck" component in gcc. If
> gcc decides not to support in-class definition for static const double,
> then flag the statement as an error. I really don't see why the compile
You can reject non-integer in-class static const definitions with:
CXXFLAGS += -ansi -pedantic-errors
(also rejects many other non-standardisms, if you're prepared to do so!)
> doesn't substitute the value everywhere it see the reference (as you
> mentioned), because it is a static const!
The compiler is really not required to do even the simplest of
optimizations. -O0 really means NO optimizations, even the no-brainers
such as this one.
FWIW, as a user, I build/test with different optimization levels to catch
these sort of errors (in case I forget a const definition).
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31904