c++/2123: Array initializer
schreib@stoch.fmi.uni-passau.de
schreib@stoch.fmi.uni-passau.de
Wed Feb 28 05:56:00 GMT 2001
>Number: 2123
>Category: c++
>Synopsis: Array initializer
>Confidential: no
>Severity: critical
>Priority: medium
>Responsible: unassigned
>State: open
>Class: accepts-illegal
>Submitter-Id: net
>Arrival-Date: Wed Feb 28 05:56:00 PST 2001
>Closed-Date:
>Last-Modified:
>Originator: Gernot Schreib
>Release: gcc version 2.95.2 19991024 (release); gcc version 2.97 20010205 (experimental)
>Organization:
>Environment:
Linux 2.2; Solaris 2.6, 2.8
>Description:
c++ compiles without any message, but the result is
> run
0 0 0 0 0
As far as I known, the code is wrong
(no initializer allowed).
>How-To-Repeat:
#include <iostream>
int main()
{
int* x=new int[5](1); // allowed by ANSI ???
for (unsigned int k=0;k<5;k++) {
std::cout << " " << x[k];
}
std::cout << std::endl;
}
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the Gcc-bugs
mailing list