aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorMark Mitchell <mmitchel@gcc.gnu.org>1998-06-13 23:34:56 +0000
committerMark Mitchell <mmitchel@gcc.gnu.org>1998-06-13 23:34:56 +0000
commit5e7955289faf43ba7ff15c5815d768657fb225d8 (patch)
tree95efbfa9c4155afe9eff827cae205f67203b8046 /gcc
parenta61e1825f5ec2d481da2628c4d95534b5ff67e12 (diff)
downloadgcc-5e7955289faf43ba7ff15c5815d768657fb225d8.zip
gcc-5e7955289faf43ba7ff15c5815d768657fb225d8.tar.gz
gcc-5e7955289faf43ba7ff15c5815d768657fb225d8.tar.bz2
search.c (get_matching_virtual): Note that member templates cannot override virtual functions.
* search.c (get_matching_virtual): Note that member templates cannot override virtual functions. From-SVN: r20497
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/search.c7
-rw-r--r--gcc/testsuite/g++.old-deja/g++.pt/memtemp76.C17
2 files changed, 24 insertions, 0 deletions
diff --git a/gcc/cp/search.c b/gcc/cp/search.c
index 1478f23..2e71de3 100644
--- a/gcc/cp/search.c
+++ b/gcc/cp/search.c
@@ -2232,6 +2232,13 @@ get_matching_virtual (binfo, fndecl, dtorp)
tree tmp = NULL_TREE;
int i;
+ if (TREE_CODE (fndecl) == TEMPLATE_DECL)
+ /* In [temp.mem] we have:
+
+ A specialization of a member function template does not
+ override a virtual function from a base class. */
+ return NULL_TREE;
+
/* Breadth first search routines start searching basetypes
of TYPE, so we must perform first ply of search here. */
if (dtorp)
diff --git a/gcc/testsuite/g++.old-deja/g++.pt/memtemp76.C b/gcc/testsuite/g++.old-deja/g++.pt/memtemp76.C
new file mode 100644
index 0000000..b202851
--- /dev/null
+++ b/gcc/testsuite/g++.old-deja/g++.pt/memtemp76.C
@@ -0,0 +1,17 @@
+// Build don't link:
+
+class base
+{
+public:
+ virtual void method()=0;
+};
+
+class der: public base
+{
+public:
+ template<class C>
+ void method()
+ {
+ C foo;
+ }
+};