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 trunk)


Hi

This is the main trunk version of PR9602 fix.  Tested on
i686-pc-linux-gnu.  OK?

--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
	TYPE is still template parameter dependent.

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-main-save/gcc/cp/typeck2.c gcc-main-new/gcc/cp/typeck2.c
*** gcc-main-save/gcc/cp/typeck2.c	Thu Jan 30 21:19:09 2003
--- gcc-main-new/gcc/cp/typeck2.c	Sat Feb 22 18:45:29 2003
*************** abstract_virtuals_error (decl, type)
*** 143,148 ****
--- 143,153 ----
         CLASSTYPE_PURE_VIRTUALS holds the inline friends.  */
      return 0;
  
+   if (dependent_type_p (type))
+     /* For class template, CLASSTYPE_PURE_VIRTUALS always
+        contains inline friends.  */
+     return 0;
+ 
    u = CLASSTYPE_PURE_VIRTUALS (type);
    if (decl)
      {
diff -cprN gcc-main-save/gcc/testsuite/g++.dg/template/friend16.C gcc-main-new/gcc/testsuite/g++.dg/template/friend16.C
*** gcc-main-save/gcc/testsuite/g++.dg/template/friend16.C	Thu Jan  1 07:00:00 1970
--- gcc-main-new/gcc/testsuite/g++.dg/template/friend16.C	Thu Feb 20 20:47:11 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]