From mboxrd@z Thu Jan 1 00:00:00 1970 From: gdr@codesourcery.com To: gcc-gnats@gcc.gnu.org Subject: c++/4003: ICE on template instantiation including friendship declaration. Date: Sat, 11 Aug 2001 03:46:00 -0000 Message-id: <20010811103635.1628.qmail@sourceware.cygnus.com> X-SW-Source: 2001-08/msg00198.html List-Id: >Number: 4003 >Category: c++ >Synopsis: ICE on template instantiation including friendship declaration. >Confidential: no >Severity: serious >Priority: high >Responsible: unassigned >State: open >Class: ice-on-legal-code >Submitter-Id: net >Arrival-Date: Sat Aug 11 03:46:05 PDT 2001 >Closed-Date: >Last-Modified: >Originator: Gabriel Dos Reis (gdr@codesourcery.com) >Release: GCC-3.0.1 and GCC-3.1 >Organization: >Environment: Immaterial >Description: The below produces an ICE. A regression over gcc-2.95.x >How-To-Repeat: >Fix: >Release-Note: >Audit-Trail: >Unformatted: ----gnatsweb-attachment---- Content-Type: text/plain; name="sm.C" Content-Disposition: inline; filename="sm.C" template class BinaryTree; template void move(BinaryTree&, typename BinaryTree::iterator, BinaryTree&, typename BinaryTree::iterator); template class BinaryTree { public: class iterator { private: int i; friend void move(BinaryTree &t1,iterator n1, BinaryTree &t2,iterator n2); }; }; template inline void move(BinaryTree &t1, typename BinaryTree::iterator n1, BinaryTree &t2, typename BinaryTree::iterator n2) { int x = n1.i + n2.i; // this is the line that uses the friendship } int main() { typedef BinaryTree BT; BT t; BT::iterator n; move(t, n, t, n); }