This is the mail archive of the 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]

Re: C++ PATCH: Disallow floating-point literals in integral-constantexpressions

Mike Stump wrote:
On Jan 31, 2005, at 5:02 PM, Mark Mitchell wrote:

The standard says that floating-point literals are only allowed in
integral constant expressions if they are immediately cast to an
integral or enumeration type.  When I implemented checks for integral
constant-expressions, I failed to check this case.  Remedied with the
attached patch.

If users have this in their code, then this can be seen as a removal of a feature by them. In that case, we should warn about it for a release, then make it an error, or put it under -fpermissive.

We have checks for virtually all invalid integral constant expressions in GCC 3.4; we missed this case. So, we're fixing that bug.

It is not true that if GCC X accepted a piece of code, but GCC X + 1 does not, then we have removed a feature and must deprecate, etc. There is nothing wrong with diagnosing invalid code, unless the invalid code was part of an intentional (and usually documented) GNU extension. Other C++ compilers (like EDG) do the same thing: the guarantee from release-to-release is that documented extensions and conforming code will continue to work, not that all bugs will go through the deprecation cycle.

Mark Mitchell
CodeSourcery, LLC
(916) 791-8304

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