This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
c++/4003: ICE on template instantiation including friendship declaration.
- To: gcc-gnats at gcc dot gnu dot org
- Subject: c++/4003: ICE on template instantiation including friendship declaration.
- From: gdr at codesourcery dot com
- Date: 11 Aug 2001 10:36:35 -0000
- Reply-To: gdr at codesourcery dot com
>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<typename> class BinaryTree;
template<typename T>
void move(BinaryTree<T>&, typename BinaryTree<T>::iterator,
BinaryTree<T>&, typename BinaryTree<T>::iterator);
template<class T>
class BinaryTree {
public:
class iterator {
private:
int i;
friend void move<T>(BinaryTree<T> &t1,iterator n1,
BinaryTree<T> &t2,iterator n2);
};
};
template<class T>
inline void move(BinaryTree<T> &t1, typename BinaryTree<T>::iterator n1,
BinaryTree<T> &t2, typename BinaryTree<T>::iterator n2)
{
int x = n1.i + n2.i; // this is the line that uses the friendship
}
int main() {
typedef BinaryTree<int> BT;
BT t;
BT::iterator n;
move(t, n, t, n);
}