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

            Bug ID: 92910
           Summary: Valid lambda inside variadic template does not compile
           Product: gcc
           Version: 7.5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: soko.slav at yandex dot ru
  Target Milestone: ---

Code:

template <class ... Ts>
void foo()
{
    (
        []
        {
            static_cast<Ts*>(nullptr);
        }()
        , ...
    );
}
template void foo<>();

fails to compile with message

In lambda function:
<source>:7:13: error: parameter packs not expanded with '...':
             static_cast<Ts*>(nullptr);
<source>:7:13: note:         'Ts'
<source>: In function 'void foo()':
<source>:8:10: error: operand of fold expression has no unexpanded parameter
packs

up to gcc-7.5 (x86-64) 
compiles on gcc-8.1 and later

Tested locally and on https://godbolt.org/z/F2jR9U

Reply via email to