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]

Re: c++/7008: unexpected error message "var was not declared in this scope"


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



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