This is the mail archive of the 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]

Re: Lambda templates and implicit function templates.

On 01.09.2013 21:05, Jason Merrill wrote:
On 08/27/2013 03:42 PM, Adam Butcher wrote:
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.

I would expect that to work.  Does the specification not provide for
deduction in that case?

It doesn't forbid it as far as I can see.  But it also gives no
example of a stateless lambda with a variadic parameter.  TBH I just
couldn't figure out the right implementation so thought it better
to omit the conversion operator on the assumption that it is not a
common use case rather than ICE .  I'll have a rethink based on your
follow up to 2/4 and try to get a pack expansion working there.

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 to compile.  Currently (transforming
the 'auto&&...' to an explicit '<typename T...> T&&...') appears to
yield the bug.

Bug 41933 is specifically about lambda capture; I think you're
running into something else.

The problem is in expanding the 'ts' capture from the  It
looks like this:

  1 auto vglambda = [](auto printer) {
2 return [=](auto&& ... ts) { // OK: ts is a function parameter pack
  3     printer(std::forward<decltype(ts)>(ts)...);
  4     return [=]() {
  5       printer(ts ...);
  6     };
  7   };
  8 };

It is the expansion of the captured 'ts' on line 5 that I think yields
the bug.  Might be slightly different to 41933 though due to not being
explicitly captured as "ts...". Unsure. My point was that in order to
conform this issue will need to be fixed as well as getting the
'auto...' syntax to work.


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