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

            Bug ID: 86728
           Summary: [Regression] unexpected error: conversion from
                    '<lambda(<type error>, ...)>' to non-scalar type
                    'std::function<void(int)>' requested
           Product: gcc
           Version: 9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: v.reshetnikov at gmail dot com
  Target Milestone: ---

/******************* BEGIN SOURCE *******************/
#include <functional>

std::function<void(int)> a = [](int x ...) { }; // OK
std::function<void(int)> b = [](auto x, ...) { }; // OK
std::function<void(int)> c = [](auto x ...) { }; /* error: conversion from
'<lambda(<type error>, ...)>' to non-scalar type 'std::function<void(int)>'
requested */
/******************** END SOURCE ********************/

The error in the last line appears with build 9.0.0 20180728 (experimental),
8.2, 8.1. This code used to compile successfully with GCC versions 6.1 - 7.3.
For comparison, the latest versions of clang and MSVC compile this code
successfully as well.

Reply via email to