This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[C++1y] [PATCH] Fix PR c++/58500


Hi,

This fixes using 'auto' in the return type of a function pointer to introduce an implicit function template parameter.

Note that this doesn't mean that 'auto' parameters in a function ptr will be treated the same; I think we need a special case for this in the implicit template parameter introduction code (or refactor to generate template parm types on the fly).

Cheers,
Adam


    gcc/cp/
    	PR c++/58500
    	* type-utils.h (find_type_usage) Only traverse one type level into
    	member function pointers.

    gcc/testsuite/
    	PR c++/58500
    	* g++.dg/cpp1y/pr58500.C: New testcase.

diff --git a/gcc/cp/type-utils.h b/gcc/cp/type-utils.h
index 3e82ca4..2febce7 100644
--- a/gcc/cp/type-utils.h
+++ b/gcc/cp/type-utils.h
@@ -47,7 +47,7 @@ find_type_usage (tree t, bool (*pred) (const_tree))

   if (TYPE_PTRMEMFUNC_P (t))
     return find_type_usage
-      (TREE_TYPE (TREE_TYPE (TYPE_PTRMEMFUNC_FN_TYPE (t))), pred);
+      (TREE_TYPE (TYPE_PTRMEMFUNC_FN_TYPE (t)), pred);

   return NULL_TREE;
 }
diff --git a/gcc/testsuite/g++.dg/cpp1y/pr58500.C b/gcc/testsuite/g++.dg/cpp1y/pr58500.C
new file mode 100644
index 0000000..b9d4a26
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1y/pr58500.C
@@ -0,0 +1,8 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++1y" }
+
+// PR c++/58500
+
+struct A {};
+
+void foo(auto (A::*)());


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]