This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/15300] New: name hiding in constructor yields random results
- From: "jaffe at broad dot mit dot edu" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 5 May 2004 19:14:44 -0000
- Subject: [Bug c++/15300] New: name hiding in constructor yields random results
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
The following code "redefine.cc" (when compiled under g++ 3.4.0 on ia64)
via "g++ redefine.cc":
#include <iostream>
using namespace std;
int main( )
{ int a = 10;
{ int a(a);
cout << a << endl; } }
prints the value 65535. When compiled with -O1 you get the value 0.
However, under g++ 3.3.3 one gets the value 10 (at all optimization
levels: -O0 or -O1 or -O2 or -O3).
Is this behavior ANSI-compliant? I looked at the standard but
couldn't find the answer.
--
Summary: name hiding in constructor yields random results
Product: gcc
Version: 3.4.0
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: jaffe at broad dot mit dot edu
CC: gcc-bugs at gcc dot gnu dot org
GCC build triplet: ia64-unknown-linux
GCC host triplet: ia64-unknown-linux
GCC target triplet: ia64-unknown-linux
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15300