From 9e236a9d6657991f841827676e2b5437cad832d4 Mon Sep 17 00:00:00 2001 From: Kriang Lerdsuwanakij Date: Mon, 24 Feb 2003 15:47:24 +0000 Subject: [PATCH] re PR c++/9602 (Total confusion about template/friend/virtual/abstract) 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 | 6 ++++++ gcc/cp/typeck2.c | 5 +++++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/g++.dg/template/friend16.C | 16 ++++++++++++++++ 4 files changed, 32 insertions(+) create mode 100644 gcc/testsuite/g++.dg/template/friend16.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 20e1f22aabe..cfdaac850d8 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2003-02-24 Kriang Lerdsuwanakij + + PR c++/9602 + * typeck2.c (abstract_virtuals_error): Don't check when + TYPE is still template parameter dependent. + 2003-02-23 Mark Mitchell PR c++/5333 diff --git a/gcc/cp/typeck2.c b/gcc/cp/typeck2.c index c7dcb527b82..5758bf4ae2f 100644 --- a/gcc/cp/typeck2.c +++ b/gcc/cp/typeck2.c @@ -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) { diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 3dad6fde31b..42df634feaf 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2003-02-24 Kriang Lerdsuwanakij + + PR c++/9602 + * g++.dg/template/friend16.C: New test. + 2003-02-23 Mark Mitchell 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 index 00000000000..3165ed2b59d --- /dev/null +++ b/gcc/testsuite/g++.dg/template/friend16.C @@ -0,0 +1,16 @@ +// { dg-do compile } + +// Origin: Wolfgang Bangerth + +// PR c++/9602: Inline friend/pure virtual tree data sharing in +// class template. + +template struct X { + void foo (X); + friend void bar () {} +}; + +template +void X::foo (X x) {} + +template struct X;