From 5a9a196102ff0d1bf27831e0ce396049cc334db8 Mon Sep 17 00:00:00 2001
From: Nathan Sidwell <nathan@codesourcery.com>
Date: Mon, 30 Sep 2002 19:33:06 +0000
Subject: [PATCH] tree.c (really_overloaded_fn): TEMPLATE_ID_EXPRs are also
 overloaded.

cp:
	* tree.c (really_overloaded_fn): TEMPLATE_ID_EXPRs are also
	overloaded.
testsuite:
	* g++.dg/overload/member1.C: New test.

From-SVN: r57662
---
 gcc/cp/ChangeLog                        |  5 +++++
 gcc/cp/tree.c                           |  7 ++++---
 gcc/testsuite/ChangeLog                 |  4 ++++
 gcc/testsuite/g++.dg/overload/member1.C | 22 ++++++++++++++++++++++
 4 files changed, 35 insertions(+), 3 deletions(-)
 create mode 100644 gcc/testsuite/g++.dg/overload/member1.C

diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index c3690f3dca1b..e6ea3fe23064 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,8 @@
+2002-09-30  Nathan Sidwell  <nathan@codesourcery.com>
+
+	* tree.c (really_overloaded_fn): TEMPLATE_ID_EXPRs are also
+	overloaded.
+
 2002-09-30  Steve Ellcey  <sje@cup.hp.com>
 
 	* class.c (build_vtbl_initializer): Add cast.
diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c
index 588b7108095e..4b1142b11545 100644
--- a/gcc/cp/tree.c
+++ b/gcc/cp/tree.c
@@ -1012,9 +1012,10 @@ really_overloaded_fn (x)
     x = TREE_OPERAND (x, 1);
   if (BASELINK_P (x))
     x = BASELINK_FUNCTIONS (x);
-  return (TREE_CODE (x) == OVERLOAD 
-	  && (OVL_CHAIN (x)
-	      || DECL_FUNCTION_TEMPLATE_P (OVL_FUNCTION (x))));
+  
+  return ((TREE_CODE (x) == OVERLOAD && OVL_CHAIN (x))
+	  || DECL_FUNCTION_TEMPLATE_P (OVL_CURRENT (x))
+	  || TREE_CODE (x) == TEMPLATE_ID_EXPR);
 }
 
 /* Return the OVERLOAD or FUNCTION_DECL inside FNS.  FNS can be an
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index d444eea27d56..2a84ea84780a 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2002-09-30  Nathan Sidwell  <nathan@codesourcery.com>
+
+	* g++.dg/overload/member1.C: New test.
+
 2002-09-30  Mark Mitchell  <mark@codesourcery.com>
 
 	* g++.dg/abi/empty7.C: New test.
diff --git a/gcc/testsuite/g++.dg/overload/member1.C b/gcc/testsuite/g++.dg/overload/member1.C
new file mode 100644
index 000000000000..29896a5110fa
--- /dev/null
+++ b/gcc/testsuite/g++.dg/overload/member1.C
@@ -0,0 +1,22 @@
+// { dg-do compile }
+
+// Copyright (C) 2002 Free Software Foundation, Inc.
+// Contributed by Nathan Sidwell 29 Sep 2002 <nathan@codesourcery.com>
+
+struct X
+{
+  template<typename T> static void ProcessProxy ();
+  typedef void (*Callback) ();
+  void Process (Callback);
+  
+  template<typename T> void Process ()
+  {
+    Process (&ProcessProxy<T>);
+  }
+  
+};
+
+void foo (X *x)
+{
+  x->Process<int> ();
+}
-- 
GitLab