re PR c++/57825 (Template specialization for ref qualified member pointers)
authorJason Merrill <jason@redhat.com>
Wed, 7 Aug 2013 01:17:36 +0000 (21:17 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Wed, 7 Aug 2013 01:17:36 +0000 (21:17 -0400)
PR c++/57825
* tree.c (strip_typedefs) [METHOD_TYPE]: Preserve ref-qualifier.

From-SVN: r201550

gcc/cp/ChangeLog
gcc/cp/tree.c
gcc/testsuite/g++.dg/cpp0x/ref-qual14.C [new file with mode: 0644]

index f85fd3f..5083f70 100644 (file)
@@ -1,3 +1,8 @@
+2013-08-06  Jason Merrill  <jason@redhat.com>
+
+       PR c++/57825
+       * tree.c (strip_typedefs) [METHOD_TYPE]: Preserve ref-qualifier.
+
 2013-08-05  Paolo Carlini  <paolo.carlini@oracle.com>
 
        PR c++/58080
index f8b4bbc..63ec7fa 100644 (file)
@@ -1236,6 +1236,8 @@ strip_typedefs (tree t)
            result =
              build_method_type_directly (class_type, type,
                                          TREE_CHAIN (arg_types));
+           result
+             = build_ref_qualified_type (result, type_memfn_rqual (t));
          }
        else
          {
diff --git a/gcc/testsuite/g++.dg/cpp0x/ref-qual14.C b/gcc/testsuite/g++.dg/cpp0x/ref-qual14.C
new file mode 100644 (file)
index 0000000..8e55551
--- /dev/null
@@ -0,0 +1,18 @@
+// PR c++/57825
+// { dg-do compile { target c++11 } }
+
+template<typename T>
+struct target_class
+{};
+
+template<typename Class, typename Ret, typename... Args>
+struct target_class<Ret (Class::*)(Args...)>
+{};
+
+template<typename Class, typename Ret, typename... Args>
+struct target_class<Ret (Class::*)(Args...) &>
+{};
+
+template<typename Class, typename Ret, typename... Args>
+struct target_class<Ret (Class::*)(Args...) &&>
+{};