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]
Other format: [Raw text]

c++/10682 caused by patch for c++/7639


Your change

2002-10-30  Kriang Lerdsuwanakij  <lerdsuwa@users.sourceforge.net>

	* pt.c (instantiate_class_template): Use CLASSTYPE_DECL_LIST
	to process members and friends in the order of declaration.

broke PR 10682 by changing 

! 	/* R will have a TREE_CHAIN if and only if it has already been
! 	   processed by finish_member_declaration.  This can happen
! 	   if, for example, it is a TYPE_DECL for a class-scoped
! 	   ENUMERAL_TYPE; such a thing will already have been added to
! 	   the field list by tsubst_enum above.  */
! 	if (!TREE_CHAIN (r))
! 	  {
! 	    set_current_access_from_decl (r);
! 	    finish_member_declaration (r);
! 	  }

to

! 		  /* If it is a TYPE_DECL for a class-scoped ENUMERAL_TYPE,
! 		     such a thing will already have been added to the field
! 		     list by tsubst_enum in finish_member_declaration in the
! 		     CLASSTYPE_TAGS case above.  */
! 		  if (!(TREE_CODE (r) == TYPE_DECL
! 			&& TREE_CODE (TREE_TYPE (r)) == ENUMERAL_TYPE
! 			&& TYPE_CONTEXT (TREE_TYPE (r)) == type))
! 		    {
! 		      set_current_access_from_decl (r);
! 		      finish_member_declaration (r);
! 		    }

The reduced testcase for 10682 contains a class-scope typedef of enum type,
but the above comment doesn't apply to it because it isn't an artificial
typedef.  This bug can be fixed by adding

                        && !DECL_ARTIFICIAL (r)

to the new code, but it's unclear to me why you made the change in the
first place.  If you think a condition will only occur in a particular
circumstance, rather than just change the condition, you should also add
aborts to check that your guess is correct.

Jason


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