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
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-bugs
mailing list