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++ PATCH for 3.3/trunk] Fix regression PR10682 (typedef enum intemplate instantiation)


Hi

Here is the patch that fixes PR 10682, a regression in 3.3 and trunk
caused by my earlier template instantiation work.  A condition in
instantiate_class_template doesn't catch implicit typedef created
for enum properly.

Tested on i686-pc-linux-gnu.  OK to commit to 3.3 and trunk?

--Kriang


2003-05-22  Kriang Lerdsuwanakij  <lerdsuwa@users.sourceforge.net>

	PR c++/10682
	* pt.c (instantiate_class_template): Use DECL_ARTIFICIAL to
	check for implicitly created typedef to an enum.

2003-05-22  Kriang Lerdsuwanakij  <lerdsuwa@users.sourceforge.net>

	PR c++/10682
	* g++.dg/template/instantiate4.C: New test.


diff -cprN gcc-33-save/gcc/cp/pt.c gcc-33-new/gcc/cp/pt.c
*** gcc-33-save/gcc/cp/pt.c	Thu May 22 19:19:30 2003
--- gcc-33-new/gcc/cp/pt.c	Thu May 22 20:36:57 2003
*************** instantiate_class_template (type)
*** 5528,5534 ****
  		     CLASSTYPE_NESTED_UDTS 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);
--- 5528,5534 ----
  		     CLASSTYPE_NESTED_UDTS case above.  */
  		  if (!(TREE_CODE (r) == TYPE_DECL
  			&& TREE_CODE (TREE_TYPE (r)) == ENUMERAL_TYPE
! 			&& DECL_ARTIFICIAL (r)))
  		    {
  		      set_current_access_from_decl (r);
  		      finish_member_declaration (r);
diff -cprN gcc-33-save/gcc/testsuite/g++.dg/template/instantiate4.C gcc-33-new/gcc/testsuite/g++.dg/template/instantiate4.C
*** gcc-33-save/gcc/testsuite/g++.dg/template/instantiate4.C	Thu Jan  1 07:00:00 1970
--- gcc-33-new/gcc/testsuite/g++.dg/template/instantiate4.C	Thu May 22 20:55:43 2003
***************
*** 0 ****
--- 1,13 ----
+ // { dg-do compile }
+ 
+ // Origin: Wolfgang Bangerth <bangerth@ticam.utexas.edu>
+ 
+ // PR c++/10682: Typedef to enum template instantiation logic.
+ 
+ template <typename T>
+ struct Foo {
+   enum E {a,b,c};
+   typedef E EE;
+ };
+ 
+ void Baz(Foo<int>::EE x);


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