This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/13358] New: long long and C++ do not mix well in 3.3/3.4
- From: "lloyd at randombit dot net" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 8 Dec 2003 18:05:57 -0000
- Subject: [Bug c++/13358] New: long long and C++ do not mix well in 3.3/3.4
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
I would request that the warning 'integer constant is too large for "%s"
type' be controllable, preferably by -Wno-long-long. As of now (3.4 20031126,
and 3.3 last time I looked), using a long long constant in C++ source causes g++
to freak out. This following code works fine with egcs 1.1.2, gcc 3.0.4, 3.1,
3.2.2, and half a dozen commercial compilers
int main()
{
unsigned long long x = 0xFEDCBA9876543210;
return 0;
}
but g++ 3.[34] will barf on it, and the only way to get it to compile at all is
with -fpermissive (I would prefer a way to kill this warning completely). If
you wondering why I don't just add ULL to everything: VC++ and some other
pre-C99 Windows compilers don't like that (at all).
I suppose technically this warning might be triggered by something other than a
long long constant, making -Wlong-long the wrong flag to control it, but odds
are pretty damn good that a contant that won't fit in a long is a long long
constant, not a typo.
Anyway, it's a highly trivial fix in c-lex.c at line 556, just add
warn_long_long to the set of conditions. Since it's on by default for C/C++,
this will not affect anyone except people who pass -Wno-long-long to the
compiler.
(If not -Wno-long-long, at least make some way to disable it besides
"-fpermissive -w", which is a really awful 'solution').
This actually effects C as well, but due to it being only a warning there, I'm
marking it as a C++ problem.
--
Summary: long long and C++ do not mix well in 3.3/3.4
Product: gcc
Version: 3.4
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: lloyd at randombit dot net
CC: gcc-bugs at gcc dot gnu dot org
GCC host triplet: i386-pc-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13358