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++/8961: template template parameter works with 2.95; 3.2.1 reports error.


Synopsis: template template parameter works with 2.95; 3.2.1 reports error.

State-Changed-From-To: open->closed
State-Changed-By: bangerth
State-Changed-When: Mon Dec 16 08:33:50 2002
State-Changed-Why:
    When you write in your partial specialization
    template<int rows>
    struct Matrix<rows,1> : Matrix_Base<rows,1,Matrix> {
        Matrix() : Matrix_Base<rows,1,Matrix>() {};
                                      ^^^^^^
    The unqualified use of "Matrix" in the template list of the
    base class initializer refers to the present class (with
    all template arguments (just in the same way as you write
    the name of the constructor as Matrix instead of
    Matrix<rows,1>. If you want to refer to the global
    template (without fixed template arguments), then you
    have to write ::Matrix, which makes your code compile.
    
    By the way, writing
    template<int rows, int cols, template<int rows, int cols> class C>
    is asking for trouble, since you use the same identifier
    names (rows, cols) twice. Use different names, or omit
    them in the template template parameter at all.
    
    W.

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


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