This is the mail archive of the gcc-prs@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]

c++/2123: Array initializer



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


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