c++/2057: bug in global "const" array
schreib@stoch.fmi.uni-passau.de
schreib@stoch.fmi.uni-passau.de
Thu Feb 22 00:06:00 GMT 2001
>Number: 2057
>Category: c++
>Synopsis: bug in global "const" array
>Confidential: no
>Severity: critical
>Priority: medium
>Responsible: unassigned
>State: open
>Class: wrong-code
>Submitter-Id: net
>Arrival-Date: Thu Feb 22 00:06:01 PST 2001
>Closed-Date:
>Last-Modified:
>Originator: schreib@stoch.fmi.uni-passau.de
>Release: gcc version 2.95.2 19991024 (release)
>Organization:
>Environment:
SuSE 6.4/Linux kernel 2.2.14
>Description:
Programm:
#include <iostream>
Output of the program below:
A=1
B=0
Output of program if we remove "const" before "B":
A=1
B=1
>How-To-Repeat:
#include <iostream>
const int A[1] = { 1 };
// const or not const ?
const
int B[1][1] = { { A[0] } };
int main()
{
std::cout << "A=" << A[0] << std::endl;
std::cout << "B=" << B[0][0] << std::endl;
return(0);
}
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the Gcc-bugs
mailing list