c++/1788: gcc 2.95.2 gives ICE when declaring variables as static in classes

rodrigc@gcc.gnu.org rodrigc@gcc.gnu.org
Sun Feb 24 12:08:00 GMT 2002


Synopsis: gcc 2.95.2 gives ICE when declaring variables as static in classes

State-Changed-From-To: analyzed->closed
State-Changed-By: rodrigc
State-Changed-When: Sun Feb 24 11:09:19 2002
State-Changed-Why:
    Compiling your testcase with gcc 3.0.4 yields the following
    compilation errors:
    Bug.cc:5: declaration does not declare anything
    Bug.cc:5: parse error before `static'
    Bug.cc:9: parse error before `static'
    Bug.cc:9: `T' was not declared in this scope
    Bug.cc:9: template argument 1 is invalid
    Bug.cc:9: ISO C++ forbids declaration of `foobar' with no typeBug.cc:5: declaration does not declare anything
    Bug.cc:5: parse error before `static'
    Bug.cc:9: parse error before `static'
    Bug.cc:9: `T' was not declared in this scope
    Bug.cc:9: template argument 1 is invalid
    Bug.cc:9: ISO C++ forbids declaration of `foobar' with no type
    
    
    If the testcase is changed, it can be compiled:
    
    template <typename T>
    class Foo
    {
          static const int foobar;
          int vertices[foobar];
    };
     
    template <typename T>
    const int Foo<T>::foobar = 4;
     
     
    int main()
    {
          Foo<int> foo;
          return(0);
    }

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



More information about the Gcc-bugs mailing list