[C++ PATCH] fix bug 532

Nathan Sidwell nathan@codesourcery.com
Thu Oct 5 01:35:00 GMT 2000


Hi,
I've installed the attached patch and testcase which fixes bug 532.
we were attempting to do `DECL_INITIAL (error_mark_node) = expr'

built & tested on i686-pc-linux-gnu, approved by Mark.

nathan
-- 
Dr Nathan Sidwell   ::   http://www.codesourcery.com   ::   CodeSourcery LLC
         'But that's a lie.' - 'Yes it is. What's your point?'
nathan@codesourcery.com : http://www.cs.bris.ac.uk/~nathan/ : nathan@acm.org
2000-10-04  Nathan Sidwell  <nathan@codesourcery.com>

	* pt.c (tsubst_expr, DECL_STMT case): Don't process if
	tsubsting fails.

Index: cp/pt.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cp/pt.c,v
retrieving revision 1.468
diff -c -3 -p -r1.468 pt.c
*** pt.c	2000/09/17 07:38:20	1.468
--- pt.c	2000/10/04 15:38:01
*************** tsubst_expr (t, args, complain, in_decl)
*** 7145,7161 ****
  	    init = DECL_INITIAL (decl);
  	    decl = tsubst (decl, args, complain, in_decl);
  	    init = tsubst_expr (init, args, complain, in_decl);
! 	    if (init)
! 	      DECL_INITIAL (decl) = error_mark_node;
! 	    /* By marking the declaration as instantiated, we avoid
! 	       trying to instantiate it.  Since instantiate_decl can't
! 	       handle local variables, and since we've already done
! 	       all that needs to be done, that's the right thing to
! 	       do.  */
! 	    if (TREE_CODE (decl) == VAR_DECL)
! 	      DECL_TEMPLATE_INSTANTIATED (decl) = 1;
! 	    maybe_push_decl (decl);
! 	    cp_finish_decl (decl, init, NULL_TREE, 0);
  	  }
  	return decl;
        }
--- 7145,7164 ----
  	    init = DECL_INITIAL (decl);
  	    decl = tsubst (decl, args, complain, in_decl);
  	    init = tsubst_expr (init, args, complain, in_decl);
! 	    if (decl != error_mark_node)
! 	      {
! 	        if (init)
! 	          DECL_INITIAL (decl) = error_mark_node;
! 	        /* By marking the declaration as instantiated, we avoid
! 	           trying to instantiate it.  Since instantiate_decl can't
! 	           handle local variables, and since we've already done
! 	           all that needs to be done, that's the right thing to
! 	           do.  */
! 	        if (TREE_CODE (decl) == VAR_DECL)
! 	          DECL_TEMPLATE_INSTANTIATED (decl) = 1;
! 	        maybe_push_decl (decl);
! 	        cp_finish_decl (decl, init, NULL_TREE, 0);
! 	      }
  	  }
  	return decl;
        }


More information about the Gcc-patches mailing list