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++/45829] Unary minus on static const class variable triggering linker error


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

--- Comment #8 from Manuel LÃpez-IbÃÃez <manu at gcc dot gnu.org> 2010-09-29 23:22:59 UTC ---
(In reply to comment #7)
> (In reply to comment #6)
> > 
> > What is the point of allowing to initialize it then?
> 
> Static const members declared with initializers can be used in constant
> expressions, see 9.4.2p4
...
> (N.B. Allowing an in-class initializer for non-integral and non-enumeration
> types in C++98 is a GCC extension.  I believe it would be conforming, but is
> not required, for "-a" to be evaluated at translation time, without requiring a
> definition of "a".)

But -a (or 0.0-a) is not a constant expression, so having an in-class
initializer seems suspicious, couldn't we warn at least? What happens if the
definition is initialized to a different value?


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