This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: explicit instantiation gives internal error
- To: austern at sgi dot com, austern at isolde dot engr dot sgi dot com
- Subject: Re: explicit instantiation gives internal error
- From: Mark Mitchell <mark at codesourcery dot com>
- Date: Tue, 11 Jan 2000 00:55:48 -0800
- Cc: gcc-bugs at gcc dot gnu dot org, jfw at cthulhu dot engr dot sgi dot com, jsiek at cthulhu dot engr dot sgi dot com
- Organization: CodeSourcery, LLC
- References: <10001031702.ZM49617@isolde.engr.sgi.com>
You wrote that this:
class A {
public:
static void f();
};
template <class T>
class B : public A {
friend void A::f();
};
template <class T>
class C : public B<T>
{
};
template class C<char>;
caused an internal compiler error. Fixed with this patch.
Thanks for the report!
--
Mark Mitchell mark@codesourcery.com
CodeSourcery, LLC http://www.codesourcery.com
2000-01-11 Mark Mitchell <mark@codesourcery.com>
* friend.c (do_friend): Don't resolve scopes when processing
template declarations, even if the qualifying scope doesn't
involve template parameters.
Index: testsuite/g++.old-deja/g++.pt/friend43.C
===================================================================
RCS file: friend43.C
diff -N friend43.C
*** /dev/null Tue May 5 13:32:27 1998
--- friend43.C Tue Jan 11 00:52:07 2000
***************
*** 0 ****
--- 1,19 ----
+ // Build don't link:
+ // Origin: Matt Austern <austern@isolde.engr.sgi.com>
+
+ class A {
+ public:
+ static void f();
+ };
+
+ template <class T>
+ class B : public A {
+ friend void A::f();
+ };
+
+ template <class T>
+ class C : public B<T>
+ {
+ };
+
+ template class C<char>;
Index: cp/friend.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cp/friend.c,v
retrieving revision 1.49
diff -c -p -r1.49 friend.c
*** friend.c 1999/10/07 16:41:47 1.49
--- friend.c 2000/01/11 08:52:12
***************
*** 1,5 ****
/* Help friends in C++.
! Copyright (C) 1997, 1998, 1999 Free Software Foundation, Inc.
This file is part of GNU CC.
--- 1,5 ----
/* Help friends in C++.
! Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
This file is part of GNU CC.
*************** do_friend (ctype, declarator, decl, parm
*** 402,408 ****
/* We can't do lookup in a type that involves template
parameters. Instead, we rely on tsubst_friend_function
to check the validity of the declaration later. */
! if (uses_template_parms (ctype))
add_friend (current_class_type, decl);
/* A nested class may declare a member of an enclosing class
to be a friend, so we do lookup here even if CTYPE is in
--- 402,408 ----
/* We can't do lookup in a type that involves template
parameters. Instead, we rely on tsubst_friend_function
to check the validity of the declaration later. */
! if (processing_template_decl)
add_friend (current_class_type, decl);
/* A nested class may declare a member of an enclosing class
to be a friend, so we do lookup here even if CTYPE is in