public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: c++/10852: Old for-scoping rules improperly used?
@ 2003-05-19 14:12 bangerth
0 siblings, 0 replies; 3+ messages in thread
From: bangerth @ 2003-05-19 14:12 UTC (permalink / raw)
To: derrick, gcc-bugs, gcc-prs, nobody
Synopsis: Old for-scoping rules improperly used?
State-Changed-From-To: open->analyzed
State-Changed-By: bangerth
State-Changed-When: Mon May 19 14:12:47 2003
State-Changed-Why:
Gaby analyzed this. Interesting bug :-)
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=10852
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: c++/10852: Old for-scoping rules improperly used?
@ 2003-05-19 8:32 Gabriel Dos Reis
0 siblings, 0 replies; 3+ messages in thread
From: Gabriel Dos Reis @ 2003-05-19 8:32 UTC (permalink / raw)
To: nobody; +Cc: gcc-prs
The following reply was made to PR c++/10852; it has been noted by GNATS.
From: Gabriel Dos Reis <gdr@integrable-solutions.net>
To: derrick@cco.caltech.edu
Cc: gcc-gnats@gcc.gnu.org
Subject: Re: c++/10852: Old for-scoping rules improperly used?
Date: 19 May 2003 10:15:54 +0200
derrick@cco.caltech.edu writes:
| 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'
That is a bug in the compiler.
The compiler should first look into X before complaining.
-- Gaby
^ permalink raw reply [flat|nested] 3+ messages in thread
* c++/10852: Old for-scoping rules improperly used?
@ 2003-05-19 7:46 derrick
0 siblings, 0 replies; 3+ messages in thread
From: derrick @ 2003-05-19 7:46 UTC (permalink / raw)
To: gcc-gnats
>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:
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2003-05-19 14:12 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-05-19 14:12 c++/10852: Old for-scoping rules improperly used? bangerth
-- strict thread matches above, loose matches on Subject: below --
2003-05-19 8:32 Gabriel Dos Reis
2003-05-19 7:46 derrick
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).