aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog7
-rw-r--r--gcc/cp/typeck.c5
-rw-r--r--gcc/testsuite/ChangeLog6
-rw-r--r--gcc/testsuite/g++.dg/template/ptrmem12.C29
4 files changed, 46 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 1f79100..ddac9f8 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,10 @@
+2005-03-22 Nathan Sidwell <nathan@codesourcery.com>
+
+ PR c++/20465
+ PR c++/20381
+ * typeck.c (build_ptrmemfunc): Allow OFFSET_REF when processing a
+ template.
+
2005-03-21 Paolo Carlini <pcarlini@suse.de>
PR c++/20461
diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c
index c2adb1c..0ddf8f2 100644
--- a/gcc/cp/typeck.c
+++ b/gcc/cp/typeck.c
@@ -5683,7 +5683,10 @@ build_ptrmemfunc (tree type, tree pfn, int force, bool c_cast_p)
return instantiate_type (type, pfn, tf_error | tf_warning);
fn = TREE_OPERAND (pfn, 0);
- gcc_assert (TREE_CODE (fn) == FUNCTION_DECL);
+ gcc_assert (TREE_CODE (fn) == FUNCTION_DECL
+ /* In a template, we will have preserved the
+ OFFSET_REF. */
+ || (processing_template_decl && TREE_CODE (fn) == OFFSET_REF));
return make_ptrmem_cst (to_type, fn);
}
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 0a73ba3..e7222ef 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,9 @@
+2005-03-22 Nathan Sidwell <nathan@codesourcery.com>
+
+ PR c++/20465
+ PR c++/20381
+ * g++.dg/template/ptrmem12.C: New.
+
2005-03-22 Hans-Peter Nilsson <hp@axis.com>
PR rtl-optimization/20527
diff --git a/gcc/testsuite/g++.dg/template/ptrmem12.C b/gcc/testsuite/g++.dg/template/ptrmem12.C
new file mode 100644
index 0000000..717b869
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/ptrmem12.C
@@ -0,0 +1,29 @@
+// Copyright (C) 2005 Free Software Foundation, Inc.
+// Contributed by Nathan Sidwell 17 Mar 2005 <nathan@codesourcery.com>
+
+// PR 20465
+// Origin: Matthias Klose <doko@debian.org>
+// Andrew Pinski <pinskia@gcc.gnu.org>
+
+template <class _Ret, class _Tp>
+void mem_fun_ref(_Ret (_Tp::*__f)());
+
+struct A {
+ double f();
+};
+
+void h ()
+{
+ mem_fun_ref(&A::f);
+}
+
+template <class T>
+void f()
+{
+ mem_fun_ref(&A::f);
+}
+
+void g()
+{
+ f<int>();
+}