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

            Bug ID: 94546
           Summary: unimplemented: unexpected AST of kind
                    nontype_argument_pack
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Keywords: rejects-valid
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: bisqwit at iki dot fi
  Target Milestone: ---

Rejects valid code.

$ g++-10 --version
g++-10 (Debian 10-20200324-1) 10.0.1 20200324 (experimental) [master revision
596c90d3559:023579257f5:906b3eb9df6c577d3f6e9c3ea5c9d7e4d1e90536]

$ g++-10 tmp.cc -std=c++20
tmp.cc: In instantiation of ‘void test(auto:1&&) [with auto:1 =
main()::<lambda(auto:2&& ...)>&]’:
tmp.cc:18:14:   required from here
tmp.cc:8:5: sorry, unimplemented: unexpected AST of kind nontype_argument_pack
    8 |     [&]<class... T>(T&&... rest)
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
    9 |     {
      |     ~
   10 |         plot(std::forward<T>(rest)...);
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   11 |     };
      |     ~
tmp.cc:8: confused by earlier errors, bailing out

#include <utility>
void test(auto&& plot)
{
    // Note: For brevity, this lambda function is only
    // defined, not called nor assigned to a variable.
    // Doing those things won’t fix the error.
    [&]<class... T>(T&&... rest)
    {
        plot(std::forward<T>(rest)...);
    };
}
int main()
{
    auto Plot = [](auto&&...)
    {
    };
    test(Plot);
}

Reply via email to