aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2003-03-11 05:33:28 -0500
committerJason Merrill <jason@gcc.gnu.org>2003-03-11 05:33:28 -0500
commit5b8e011cf6958419bf1c72940c3fd5fd9e6a791b (patch)
treeba82adcbd1d88bf912bc875165390bd5af6e19de /gcc/cp
parentb772d2f5927f157e016f434b59a33090c1137c06 (diff)
downloadgcc-5b8e011cf6958419bf1c72940c3fd5fd9e6a791b.zip
gcc-5b8e011cf6958419bf1c72940c3fd5fd9e6a791b.tar.gz
gcc-5b8e011cf6958419bf1c72940c3fd5fd9e6a791b.tar.bz2
re PR c++/8660 (template overloading ICE in tsubst_expr, at cp/pt.c:7644)
PR c++/8660 * decl2.c (check_classfn): A member template only matches a member template. From-SVN: r64166
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/decl2.c10
2 files changed, 16 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index c3299d7..f0421f1 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,9 @@
+2003-03-11 Jason Merrill <jason@redhat.com>
+
+ PR c++/8660
+ * decl2.c (check_classfn): A member template only matches a
+ member template.
+
2003-03-11 Neil Booth <neil@daikokuya.co.uk>
* Make-lang.in (CXX_C_OBJS): Update.
diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c
index 1920c65..6a4250e 100644
--- a/gcc/cp/decl2.c
+++ b/gcc/cp/decl2.c
@@ -655,6 +655,7 @@ tree
check_classfn (tree ctype, tree function)
{
int ix;
+ int is_template;
if (DECL_USE_TEMPLATE (function)
&& !(TREE_CODE (function) == TEMPLATE_DECL
@@ -672,6 +673,10 @@ check_classfn (tree ctype, tree function)
find the method, but we don't complain. */
return NULL_TREE;
+ /* OK, is this a definition of a member template? */
+ is_template = (TREE_CODE (function) == TEMPLATE_DECL
+ || (processing_template_decl - template_class_depth (ctype)));
+
ix = lookup_fnfields_1 (complete_type (ctype),
DECL_CONSTRUCTOR_P (function) ? ctor_identifier :
DECL_DESTRUCTOR_P (function) ? dtor_identifier :
@@ -704,6 +709,11 @@ check_classfn (tree ctype, tree function)
if (DECL_STATIC_FUNCTION_P (fndecl)
&& TREE_CODE (TREE_TYPE (function)) == METHOD_TYPE)
p1 = TREE_CHAIN (p1);
+
+ /* A member template definition only matches a member template
+ declaration. */
+ if (is_template != (TREE_CODE (fndecl) == TEMPLATE_DECL))
+ continue;
if (same_type_p (TREE_TYPE (TREE_TYPE (function)),
TREE_TYPE (TREE_TYPE (fndecl)))