aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog4
-rw-r--r--gcc/cp/pt.c2
-rw-r--r--gcc/testsuite/g++.dg/template/ptrmem24.C20
3 files changed, 26 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index a0ec066..502f218 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,9 @@
2014-01-28 Jason Merrill <jason@redhat.com>
+ PR c++/59818
+ * pt.c (tsubst_function_type): Make sure we keep the same function
+ quals.
+
PR c++/58701
* semantics.c (build_anon_member_initialization): Stop walking
when we run out of COMPONENT_REFs.
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 6c68bae..011db2c 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -11189,6 +11189,8 @@ tsubst_function_type (tree t,
else
{
tree r = TREE_TYPE (TREE_VALUE (arg_types));
+ /* Don't pick up extra function qualifiers from the basetype. */
+ r = cp_build_qualified_type_real (r, type_memfn_quals (t), complain);
if (! MAYBE_CLASS_TYPE_P (r))
{
/* [temp.deduct]
diff --git a/gcc/testsuite/g++.dg/template/ptrmem24.C b/gcc/testsuite/g++.dg/template/ptrmem24.C
new file mode 100644
index 0000000..a419410
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/ptrmem24.C
@@ -0,0 +1,20 @@
+// PR c++/59818
+
+template <class T>
+struct Identity {
+ typedef T type;
+};
+
+struct Foo {
+ template <typename T>
+ Foo(T*, void (Identity<T>::type::*m)(void));
+};
+
+struct Bar {
+ void Method(void) const;
+};
+
+void Bar::Method(void) const
+{
+ Foo foo(this, &Bar::Method); // { dg-error "no match" }
+}