c++/7008: unexpected error message "var was not declared in this scope"
Rafal Dabrowa
rdabrowa@poczta.onet.pl
Sun Jul 14 04:56:00 GMT 2002
The following reply was made to PR c++/7008; it has been noted by GNATS.
From: "Rafal Dabrowa" <rdabrowa@poczta.onet.pl>
To: <rdabrowa@poczta.onet.pl>, <gcc-gnats@gcc.gnu.org>,
<gcc-prs@gcc.gnu.org>, <gcc-bugs@gcc.gnu.org>, <nobody@gcc.gnu.org>
Cc:
Subject: Re: c++/7008: unexpected error message "var was not declared in this scope"
Date: Sun, 14 Jul 2002 13:58:10 +0200
I have a few additional remarks about compiler behavior.
Compiler should not take a global variable because
use of local one is forbidden. This is unclear and confusing
people. Compiler should put an error message instead.
Consider the following code:
const int N = 500;
void f(int var) {
const int N = 5;
struct { char str[N]; } z1; // error: use of local variable is
forbidden here
struct { char str[::N]; } z2; // global variable used, ok
}
Also, error text: "var was not declared in this scope" is
unclear, too. In my opinion, better is such like "use of local variable
is not allowed here".
Rafal Dabrowa
More information about the Gcc-prs
mailing list