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

lerdsuwa@gcc.gnu.org lerdsuwa@gcc.gnu.org
Sat Jul 13 03:24:00 GMT 2002


Synopsis: unexpected error message "var was not declared in this scope"

State-Changed-From-To: closed->analyzed
State-Changed-By: lerdsuwa
State-Changed-When: Sat Jul 13 02:41:36 2002
State-Changed-Why:
    PR reopened due to inconsistent behavior between ordinary
    and template functions:
     const int N = 500;
     
     void f(int var) {
         const int N = 5;
         struct { char str[N]; } zz;
         cout << "sizeof(zz) = " << sizeof(zz) << endl;
     }
     template <class T> void g(T var) {
         const int N = 5;
         struct { char str[N]; } zz;
         cout << "sizeof(zz) = " << sizeof(zz) << endl;
     }
     int main() { f(1); g(1); }
     

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=7008



More information about the Gcc-bugs mailing list