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]

[C++ PATCH] fix bug 532


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;
        }
// Build don't link:
// Copyright (C) 2000 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 4 Oct 2000 <nathan@codesourcery.com>

// Bug 532. We failed to bail out when tsubsting a _DECL failed

class ATOMSET
{
};

template <class T>
void addConstsTo(const T &container)
{
typename T::const_iterator l = 0; // ERROR - no type const_iterator
}

void tallyConstants()
{
addConstsTo(ATOMSET());
}

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