[Bug libstdc++/77451] Cannot convert lambda [](auto&&...){} to std::function<void()>

2017-01-13 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77451

--- Comment #2 from Jonathan Wakely  ---
This is a compiler bug not a library one:

int main()
{
  auto l = [](auto&&...) {};
  l();
}

l.cc: In function β€˜int main()’:
l.cc:4:5: error: no match for call to β€˜(main()::) ()’
   l();
 ^
l.cc:3:24: note: candidate: template main()::::operator decltype (((const main()::*)((const
main()::*
const)0))->operator()(static_cast())) (*)(auto:1&&, ...)()
const 
   auto l = [](auto&&...) {};
^
l.cc:3:24: note:   template argument deduction/substitution failed:
l.cc:4:5: note:   candidate expects 1 argument, 0 provided
   l();
 ^
l.cc:3:24: note: candidate: template main()::
   auto l = [](auto&&...) {};
^
l.cc:3:24: note:   template argument deduction/substitution failed:
l.cc:4:5: note:   candidate expects 1 argument, 0 provided
   l();
 ^


It works fine if you call it as l(1) or l(1, 2).

Not a regression, it's failed the same way since generic lambdas were added to
4.9

[Bug libstdc++/77451] Cannot convert lambda [](auto&&...){} to std::function<void()>

2017-01-13 Thread rs2740 at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77451

TC  changed:

   What|Removed |Added

 CC||rs2740 at gmail dot com

--- Comment #1 from TC  ---
This is not a libstdc++ bug. It's caused by GCC misparsing the ... in
[](auto&&...) {} (i.e., a dup of bug 64095).

Under the mistaken parse (which is equivalent to [](auto&&, ...) {}),
std::function's constructor correctly refuses to accept the lambda.