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++/16711] [3.4/3.5 regression] Bug in reporting integral constant expressions problems


------- 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


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