This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[C++1y] [PATCH] Fix PR c++/58500
- From: Adam Butcher <adam at jessamine dot co dot uk>
- To: Gcc Patches <gcc-patches at gcc dot gnu dot org>
- Cc: Volker Reichelt <reichelt at gcc dot gnu dot org>, Jason Merrill <jason at redhat dot com>, Jonathan Wakely <jwakely dot gcc at gmail dot com>
- Date: Mon, 23 Sep 2013 08:08:12 +0100
- Subject: [C++1y] [PATCH] Fix PR c++/58500
- Authentication-results: sourceware.org; auth=none
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::*)());