This is the mail archive of the gcc-bugs@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]
Other format: [Raw text]

[Bug c++/15300] New: name hiding in constructor yields random results


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


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