This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/34119] New: gcc incorrectly allows constant zero-sized array
- From: "kkoehne at trolltech dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 16 Nov 2007 14:34:22 -0000
- Subject: [Bug c++/34119] New: gcc incorrectly allows constant zero-sized array
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
const int foo[] = {};
should be an error according to the ISO:ANSI standard:
"An array of unknown size initialized with a brace-enclosed initializer-list
containing n initializers, >>>where n shall be greater than zero<<<, is defined
as having n elements"
http://www.kuzbass.ru:8086/docs/isocpp/decl.html , Section 8.5.1.6
However, gcc compiles it without any errors/warnings, even with -ansi
-pedantic.
--
Summary: gcc incorrectly allows constant zero-sized array
Product: gcc
Version: 3.4.4
Status: UNCONFIRMED
Severity: minor
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: kkoehne at trolltech dot com
GCC host triplet: CYGWIN_NT-6.0
GCC target triplet: CYGWIN_NT-6.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34119