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] Fix PR9602, a regression (revised for 3.2/3.3)


Hi

This is the revised fix for PR9602 I submitted yesterday.  This is 
intended for GCC 3.2/3.3.  A patch for main trunk will be sent in
a separate mail.  It uses processing_template_decl as suggested 
by Mark.

Bootstrapped and tested on i686-pc-linux-gnu.  OK to commit to
3.3 branch, and maybe 3.2?

--Kriang


2003-02-22  Kriang Lerdsuwanakij  <lerdsuwa at users dot sourceforge dot net>

	PR c++/9602
	* typeck2.c (abstract_virtuals_error): Don't check when we
	are processing a template.

2003-02-22  Kriang Lerdsuwanakij  <lerdsuwa at users dot sourceforge dot net>

	PR c++/9602
	* g++.dg/template/friend16.C: New test.


diff -cprN gcc-33-save/gcc/cp/typeck2.c gcc-33-new/gcc/cp/typeck2.c
*** gcc-33-save/gcc/cp/typeck2.c	Thu Oct 31 20:53:28 2002
--- gcc-33-new/gcc/cp/typeck2.c	Sat Feb 22 18:46:54 2003
*************** abstract_virtuals_error (decl, type)
*** 133,138 ****
--- 133,144 ----
    tree u;
    tree tu;
  
+   if (processing_template_decl)
+     /* If we are processing a template, TYPE may be a template
+        class where CLASSTYPE_PURE_VIRTUALS always contains
+        inline friends.  */
+     return 0;
+ 
    if (!CLASS_TYPE_P (type) || !CLASSTYPE_PURE_VIRTUALS (type))
      return 0;
  
diff -cprN gcc-33-save/gcc/testsuite/g++.dg/template/friend16.C gcc-33-new/gcc/testsuite/g++.dg/template/friend16.C
*** gcc-33-save/gcc/testsuite/g++.dg/template/friend16.C	Thu Jan  1 07:00:00 1970
--- gcc-33-new/gcc/testsuite/g++.dg/template/friend16.C	Sat Feb 22 18:51:45 2003
***************
*** 0 ****
--- 1,16 ----
+ // { dg-do compile }
+ 
+ // Origin: Wolfgang Bangerth <bangerth at ticam dot utexas dot edu>
+ 
+ // PR c++/9602: Inline friend/pure virtual tree data sharing in
+ // class template.
+ 
+ template <typename T> struct X {
+   void foo (X);
+   friend void bar () {}
+ };
+     
+ template <typename T>
+ void X<T>::foo (X x) {}
+     
+ template struct X<int>;


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