C++: inlining problems with current CVS

Mark Mitchell mark@codesourcery.com
Wed Nov 24 17:57:00 GMT 1999


Fixed with this patch:


--
Mark Mitchell                   mark@codesourcery.com
CodeSourcery, LLC               http://www.codesourcery.com

1999-11-24  Mark Mitchell  <mark@codesourcery.com>

	* pt.c (tsubst_decl): Copy TREE_ASM_WRITTEN for VAR_DECLs.

Index: testsuite/g++.old-deja/g++.pt/inline1.C
===================================================================
RCS file: inline1.C
diff -N inline1.C
*** /dev/null	Tue May  5 13:32:27 1998
--- inline1.C	Wed Nov 24 17:54:40 1999
***************
*** 0 ****
--- 1,14 ----
+ // Build don't link:
+ // Special g++ Options: -O2 -Winline
+ // Origin: Mark Mitchell <mark@codesourcery.com>
+ 
+ template <class T>
+ inline void f ()
+ {
+   
+ }
+ 
+ void g ()
+ {
+   f<int> ();
+ }
Index: pt.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cp/pt.c,v
retrieving revision 1.384
diff -c -p -r1.384 pt.c
*** pt.c	1999/11/23 02:49:40	1.384
--- pt.c	1999/11/25 01:54:02
*************** tsubst_decl (t, args, type, in_decl)
*** 5913,5918 ****
--- 5913,5923 ----
  	    TREE_TYPE (r) = TREE_TYPE (DECL_INITIAL (r));
  	  }
  
+ 	/* If the template variable was marked TREE_ASM_WRITTEN, that
+ 	   means we don't need to write out any of the instantiations
+ 	   either.  (__FUNCTION__ and its ilk are marked thusly.)  */
+ 	TREE_ASM_WRITTEN (r) = TREE_ASM_WRITTEN (t);
+ 
  	/* Even if the original location is out of scope, the newly
  	   substituted one is not.  */
  	if (TREE_CODE (r) == VAR_DECL)


More information about the Gcc-patches mailing list