This is the mail archive of the gcc-patches@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: template breakage



Jason --

  Here's a fix, I think.  The test here did not match the
corresponding comment; it didn't even before I made my changes, but
my change unmasked this bug.  OK to check in?

-- 
Mark Mitchell 			mark@markmitchell.com
Mark Mitchell Consulting	http://www.markmitchell.com

1998-05-28  Mark Mitchell  <mark@markmitchell.com>

	* pt.c (instantiate_decl): Make test for whether or not static
	variables should be instantiated early match its comment.

Index: static3.C
===================================================================
RCS file: static3.C
diff -N static3.C
*** /dev/null	Mon Dec 31 20:00:00 1979
--- static3.C	Thu May 28 15:24:37 1998
***************
*** 0 ****
--- 1,12 ----
+ template<class T>
+ struct A {
+   static T arr[5];
+ };
+ 
+ template <class T>
+ T A<T>::arr[5] = { 0, 1, 2, 3, 4 };
+ 
+ main ()
+ {
+   return A<int>::arr[0];
+ }
Index: pt.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/cp/pt.c,v
retrieving revision 1.147
diff -c -p -r1.147 pt.c
*** pt.c	1998/05/27 19:11:33	1.147
--- pt.c	1998/05/28 22:25:19
*************** instantiate_decl (d)
*** 7141,7146 ****
--- 7141,7147 ----
      goto out;
  
    if (TREE_CODE (d) == VAR_DECL 
+       && TREE_READONLY (d)
        && DECL_INITIAL (d) == NULL_TREE
        && DECL_INITIAL (code_pattern) != NULL_TREE)
      /* We need to set up DECL_INITIAL regardless of pattern_defined if


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