This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH 1/4] Support lambda 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>
- Date: Thu, 05 Sep 2013 20:14:28 +0100
- Subject: Re: [PATCH 1/4] Support lambda templates.
- Authentication-results: sourceware.org; auth=none
- References: <1377632573-14453-1-git-send-email-adam at jessamine dot co dot uk> <1377632573-14453-2-git-send-email-adam at jessamine dot co dot uk> <5223A1FD dot 7080403 at redhat dot com> <4a32a5dbf7dc798f3b2aa4e9139662f6 at imap dot force9 dot net> <5224DA38 dot 8050508 at redhat dot com> <b2d7c36ababbbb71f4df83bbf1e265a2 at imap dot force9 dot net> <52255C7A dot 70404 at redhat dot com> <682fa7ec431e8595ccb35fe0b1020d4e at imap dot force9 dot net> <522653CC dot 8070605 at redhat dot com>
On 03.09.2013 22:25, Jason Merrill wrote:
On 09/03/2013 03:50 PM, Adam Butcher wrote:
Problem is that no RTL is set for the incoming parms in the
instantiation of the expansion. It ICEs in gimple_expand_cfg
because 'DECL_RTL_IF_SET
(var)' returns nullptr for the incoming parms resulting in a failed
assertion that
SA.partition_to_pseudo[i] is non-null.
Sounds like a problem with how _FUN's parameters are instantiated.
I'm not sure why it would be special.
Does using a function parameter pack in the lambda body work
currently? If so, how are the expanded parameters different?
Yes it does work. And I think (hope) I've cracked it;
make_pack_expansion needs to be called in the body of the thunk (i.e.
after start_preparsed_function).
If I butcher the implementation so that I rewrite any parameter packs
with their expansion prior to building the call in return statement, it
seems to work.
Certainly the following does what I expect it to, the trees look right
and, more importantly, it doesn't ICE!
auto g = [] <typename... P> (P...) -> float { return 3.f; };
float (*pg3) (double, double, double) = g;
return pg3(1,2,3);
I'll try to clean up what I've got then submit a rolled up patch.
Cheers,
Adam