From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29281 invoked by alias); 19 May 2003 07:46:01 -0000 Mailing-List: contact gcc-prs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-prs-owner@gcc.gnu.org Received: (qmail 29248 invoked by uid 71); 19 May 2003 07:46:00 -0000 Resent-Date: 19 May 2003 07:46:00 -0000 Resent-Message-ID: <20030519074600.29247.qmail@sources.redhat.com> Resent-From: gcc-gnats@gcc.gnu.org (GNATS Filer) Resent-Cc: gcc-prs@gcc.gnu.org, gcc-bugs@gcc.gnu.org Resent-Reply-To: gcc-gnats@gcc.gnu.org, derrick@cco.caltech.edu Received: (qmail 20365 invoked by uid 48); 19 May 2003 07:41:44 -0000 Message-Id: <20030519074144.20364.qmail@sources.redhat.com> Date: Mon, 19 May 2003 07:46:00 -0000 From: derrick@cco.caltech.edu Reply-To: derrick@cco.caltech.edu To: gcc-gnats@gcc.gnu.org X-Send-Pr-Version: gnatsweb-2.9.3 (1.1.1.1.2.31) Subject: c++/10852: Old for-scoping rules improperly used? X-SW-Source: 2003-05/txt/msg02055.txt.bz2 List-Id: >Number: 10852 >Category: c++ >Synopsis: Old for-scoping rules improperly used? >Confidential: no >Severity: serious >Priority: medium >Responsible: unassigned >State: open >Class: rejects-legal >Submitter-Id: net >Arrival-Date: Mon May 19 07:46:00 UTC 2003 >Closed-Date: >Last-Modified: >Originator: Derrick Bass >Release: gcc-3.3 >Organization: >Environment: >Description: I think this is a bug in g++; but there is always the possibility that it is a bug in my understanding of C++. In the following code gcc assumes that the variable i at the end of function is the same as in the for loop and produces the following error: nstest.cc: In function `void f()': nstest.cc:9: error: name lookup of `i' changed for new ISO `for' scoping nstest.cc:6: error: using obsolete binding at `i' I think it should use the variable i from inside the namespace and quit complaining, but as I said, I may just be misunderstanding C++ arcana. Here's the sample code... namespace X { int i; } void f() { for (int i=0; i<10; ++i) ; using namespace X; i; } >How-To-Repeat: >Fix: Workaround is to replace "using namespace X" with "using X::i" >Release-Note: >Audit-Trail: >Unformatted: