https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77451

            Bug ID: 77451
           Summary: Cannot convert lambda [](auto&&...){} to
                    std::function<void()>
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gnu-9fbaow at upsuper dot org
  Target Milestone: ---

Test code:
> #include <functional>
> 
> int main()
> {
>   std::function<void()> f = [](auto&&...) {};
>   return 0;
> }
with
> g++-6 -std=c++14 test.cpp

The compiler outputs
> test.cpp:5:44: error: conversion from 'main()::<lambda(auto:1&&, ...)>' to 
> non-scalar type 'std::function<void()>' requested
>    std::function<void()> f = [](auto&&...) {};

Reply via email to