This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: GNU C++ version 2.96 19991025 (experimental)(sparc-sun-solaris2.7): Internal compiler error.
- To: robert at cynapps dot com
- Subject: Re: GNU C++ version 2.96 19991025 (experimental)(sparc-sun-solaris2.7): Internal compiler error.
- From: Mark Mitchell <mark at codesourcery dot com>
- Date: Mon, 29 Nov 1999 15:38:44 -0800
- Cc: gcc-bugs at gcc dot gnu dot org, acg at cynapps dot com, jra at cynapps dot com
- Organization: CodeSourcery, LLC
- References: <14360.36056.129608.728957@carlsbad.cynapps.com>
>>>>> "x" == <robert@cynapps.com> writes:
x> Putting an extern inside a templated class causes an internal
x> compiler error.
Fixed with this patch.
--
Mark Mitchell mark@codesourcery.com
CodeSourcery, LLC http://www.codesourcery.com
1999-11-29 Mark Mitchell <mark@codesourcery.com>
* pt.c (tsubst_decl): Robustify.
Index: cp/pt.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cp/pt.c,v
retrieving revision 1.385
diff -c -p -r1.385 pt.c
*** pt.c 1999/11/25 01:56:13 1.385
--- pt.c 1999/11/29 23:35:07
*************** tsubst_decl (t, args, type, in_decl)
*** 5863,5869 ****
my_friendly_assert (DECL_LANG_SPECIFIC (t)
&& DECL_TEMPLATE_INFO (t) != NULL_TREE, 0);
! if (TYPE_P (DECL_CONTEXT (t)))
ctx = tsubst_aggr_type (DECL_CONTEXT (t), args,
/*complain=*/1,
in_decl, /*entering_scope=*/1);
--- 5863,5869 ----
my_friendly_assert (DECL_LANG_SPECIFIC (t)
&& DECL_TEMPLATE_INFO (t) != NULL_TREE, 0);
! if (TYPE_P (CP_DECL_CONTEXT (t)))
ctx = tsubst_aggr_type (DECL_CONTEXT (t), args,
/*complain=*/1,
in_decl, /*entering_scope=*/1);
Index: testsuite/g++.old-deja/g++.pt/extern1.C
===================================================================
RCS file: extern1.C
diff -N extern1.C
*** /dev/null Tue May 5 13:32:27 1998
--- extern1.C Mon Nov 29 15:35:21 1999
***************
*** 0 ****
--- 1,13 ----
+ // Build don't link:
+ // Origin: Mark Mitchell <mark@codesourcery.com>
+
+ template <class T>
+ void f ()
+ {
+ extern int i;
+ extern T j;
+
+ i = j;
+ }
+
+ template void f<int>();