This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: GNU C++ version 2.96 19991025 (experimental)(sparc-sun-solaris2.7): Internal compiler error.


>>>>> "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>();


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]