re PR c++/9602 (Total confusion about template/friend/virtual/abstract)
authorKriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
Mon, 24 Feb 2003 15:47:24 +0000 (15:47 +0000)
committerKriang Lerdsuwanakij <lerdsuwa@gcc.gnu.org>
Mon, 24 Feb 2003 15:47:24 +0000 (15:47 +0000)
PR c++/9602
* typeck2.c (abstract_virtuals_error): Don't check when
TYPE is still template parameter dependent.

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

From-SVN: r63362

gcc/cp/ChangeLog
gcc/cp/typeck2.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/template/friend16.C [new file with mode: 0644]

index 20e1f22aabe1b1ed0b96a377bee7d65d37ef362c..cfdaac850d83756ecef0d356a55b92b8d722b7e5 100644 (file)
@@ -1,3 +1,9 @@
+2003-02-24  Kriang Lerdsuwanakij  <lerdsuwa@users.sourceforge.net>
+
+       PR c++/9602
+       * typeck2.c (abstract_virtuals_error): Don't check when
+       TYPE is still template parameter dependent.
+
 2003-02-23  Mark Mitchell  <mark@codesourcery.com>
 
        PR c++/5333
index c7dcb527b82e8f043dbc7c08ed6ce64090e8790f..5758bf4ae2fdb202b23f9c56457fb76bc975b91e 100644 (file)
@@ -143,6 +143,11 @@ abstract_virtuals_error (decl, type)
        CLASSTYPE_PURE_VIRTUALS holds the inline friends.  */
     return 0;
 
+  if (dependent_type_p (type))
+    /* For a dependent type, we do not yet know which functions are pure
+       virtuals.  */
+    return 0;
+
   u = CLASSTYPE_PURE_VIRTUALS (type);
   if (decl)
     {
index 3dad6fde31bf310ff2ca93db98ceb896a502ec20..42df634feaf8780d82e140102ee5c125c946effc 100644 (file)
@@ -1,3 +1,8 @@
+2003-02-24  Kriang Lerdsuwanakij  <lerdsuwa@users.sourceforge.net>
+
+       PR c++/9602
+       * g++.dg/template/friend16.C: New test.
+
 2003-02-23  Mark Mitchell  <mark@codesourcery.com>
 
        PR c++/5333
diff --git a/gcc/testsuite/g++.dg/template/friend16.C b/gcc/testsuite/g++.dg/template/friend16.C
new file mode 100644 (file)
index 0000000..3165ed2
--- /dev/null
@@ -0,0 +1,16 @@
+// { dg-do compile }
+
+// Origin: Wolfgang Bangerth <bangerth@ticam.utexas.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>;