This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/16711] [3.4/3.5 regression] Bug in reporting integral constant expressions problems
- From: "jsm at polyomino dot org dot uk" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 26 Jul 2004 20:30:26 -0000
- Subject: [Bug c++/16711] [3.4/3.5 regression] Bug in reporting integral constant expressions problems
- References: <20040726080349.16711.romixlev@yahoo.com>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From jsm at polyomino dot org dot uk 2004-07-26 20:30 -------
Subject: Re: New: Bug in reporting integral constant expressions
problems
On Mon, 26 Jul 2004, romixlev at yahoo dot com wrote:
> G++ 3.4.1 rejects some integral constant expressions that were allowed in the
> earlier versions. The same file compiled with GCC as a C file does not produce
> any errors. This report seems to be related to Bugzilla Bug 16489.
Both the C and C++ standards are clear that casts to non-integer types
aren't allowed in integral constant expressions (C90, C++) / integer
constant expressions (C99). Thus the bug is the nondiagnosis of:
> // Size of array should be an integral constant expression, or?
> // But G++ does not complain about this expression
> */
> int array [((int)(void*)1)];
The constant expressions bugs for C are bugs 456 and 5675. Addressing
them is on my C standards conformance roadmap
<http://www.srcf.ucam.org/~jsm28/gcc/#stdc>, but after dealing with other
miscellaneous obscure bugs such as 13801, and it is a fair amount of work
to implement properly an obscure area of the standard with little
relevance to real code. Given the obscurity of the area (and that there
is hardly a great deal of user interest in the finer points of
conformance), I'm surprised that this came up as a bug report, and still
more so that real code is actually using such things that are/were
undocumented extensions to constant expressions. (The intention will
still be that such undocumented extensions are liable to be removed
without notice, as those in C++ have been with the implementation of the
new parser, but it's interesting that such removal has had *any* impact on
user code.)
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16711