c++/5019: ICE on templated friends

rodrigc@gcc.gnu.org rodrigc@gcc.gnu.org
Wed Dec 5 20:46:00 GMT 2001


The following reply was made to PR c++/5019; it has been noted by GNATS.

From: rodrigc@gcc.gnu.org
To: gcc-bugs@gcc.gnu.org, gcc-gnats@gcc.gnu.org, gcc-prs@gcc.gnu.org,
  isabelle.hurbain@free.fr, nobody@gcc.gnu.org
Cc:  
Subject: Re: c++/5019: ICE on templated friends
Date: 6 Dec 2001 04:44:42 -0000

 Synopsis: ICE on templated friends
 
 State-Changed-From-To: open->feedback
 State-Changed-By: rodrigc
 State-Changed-When: Wed Dec  5 20:44:42 2001
 State-Changed-Why:
     I don't think this code is legal.
     
     gcc 3.0.3 does not ICE on this code, but issues the following
     compilation errors:
     
     In file included from driver.cpp:1:
     amatrix.h:13: friend declaration requires class-key, i.e. `friend class
        amatrix<another, M>'
     amatrix.h: In constructor `amatrix<t_element, N>::amatrix(const
        amatrix<another, M>&) [with another = double, unsigned int M = 4, t_element
        = int, unsigned int N = 4]':
     driver.cpp:8:   instantiated from here
     amatrix.h:15: `double amatrix<double, 4>::m_data[4][4]' is private
     amatrix.h:46: within this context
     amatrix.h:49: `cerr' undeclared (first use this function)
     amatrix.h:49: (Each undeclared identifier is reported only once for each
        function it appears in.)
     
     
     Compiling with the Digital Unix C++ compiler
     yielded the following compilation error:
     
     cxx: Error: amatrix.h, line 13: expected an identifier
         friend amatrix<another, M>;
     
     
     So this code is questionable.  Since gcc 3.0.3 does not
     ICE on this code, I am closing this PR.
 
 http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&pr=5019&database=gcc



More information about the Gcc-prs mailing list