This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Lambda templates and implicit function templates.
- From: Adam Butcher <adam at jessamine dot co dot uk>
- To: Jason Merrill <jason at redhat dot com>
- Cc: gcc-patches at gcc dot gnu dot org, Gabriel Dos Reis <gdr at integrable-solutions dot net>, Andrew Sutton <andrew dot n dot sutton at gmail dot com>, Adam Butcher <adam at jessamine dot co dot uk>
- Date: Tue, 27 Aug 2013 20:42:49 +0100
- Subject: Re: Lambda templates and implicit function templates.
- Authentication-results: sourceware.org; auth=none
Hi Jason,
Here's an updated patch set. The fully_implicit_function_template_p
field has been moved into cp_parser and the other comments addressed.
I've done some testing with parameter packs also. They work okay with
the explicit template parameter syntax for lambdas.
Unfortunately, due to errors being thrown 'early' in grokdeclarator, I
haven't been able to get 'auto...' (or reference/qualified variants)
working yet. I think I need to defer processing the parameter pack
internals of grokdeclarator until I have the synthesized template
parameter (or generate one on the fly in-place --- but that's
returning to the old 'on-demand' implementation which we moved away
from).
I don't know if it's the correct thing to do but the implementation
currently omits the conversion to function pointer operator if the
argument list contains a parameter pack.
One other thing, assuming the 'auto...' syntax can be made to work,
bug 41933 needs to be resolved for the expansion returned by the
generic lambda in N3690 5.1.2.5 to compile. Currently (transforming
the 'auto&&...' to an explicit '<typename T...> T&&...') appears to
yield the bug.
In particular I get:
error: expansion pattern âtsâ contains no argument packs
sorry, unimplemented: use of âtype_pack_expansionâ in template
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41933#c8
You look to have done some work on it. Any direction as to where to
go from there? If the solution requires reworking variadics somehow
might that perhaps alleviate my problems implementing 'auto...'?
Wishful thinking probably!
Cheers,
Adam
Patch summary (4):
Support lambda templates.
Don't generate lambda conversion op if arglist has parameter pack.
Support dumping type bindings in lambda diagnostics.
Support using 'auto' in a function parameter list to introduce an
implicit template parameter.
gcc/cp/cp-tree.h | 2 +
gcc/cp/decl.c | 7 +-
gcc/cp/decl2.c | 5 +-
gcc/cp/error.c | 22 +++---
gcc/cp/lambda.c | 115 ++++++++++++++++++++++-----
gcc/cp/parser.c | 222 +++++++++++++++++++++++++++++++++++++++++++++++++---
gcc/cp/parser.h | 6 ++
gcc/cp/pt.c | 39 +++++----
gcc/cp/type-utils.h | 56 +++++++++++++
9 files changed, 413 insertions(+), 61 deletions(-)
create mode 100644 gcc/cp/type-utils.h
--
1.8.4