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

            Bug ID: 89687
           Summary: Empty pack expansion in `decltype` results in cryptic
                    compiler error (dump_expr)
           Product: gcc
           Version: 9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: vittorio.romeo at outlook dot com
  Target Milestone: ---

Consider the following code:

    template <typename F>
    void foo(F f) 
    {
        [f](auto... xs) 
        {
            [xs...]() -> decltype(f(xs...)) { };
        };
    }

    int main()
    {
        foo([]{ });
    }

Live example on godbolt.org:
https://gcc.godbolt.org/z/DTC3f6

It compiles under clang++ trunk, but fails to compile under g++ trunk (9.0.1
20190311) with the following error:

    <source>: In instantiation of 'void foo(F) [with F = main()::<lambda()>]':
    <source>:12:14:   required from here
    <source>:6:32: error: expansion pattern '#'nontype_argument_pack' not
supported by dump_expr#<expression error>' contains no parameter packs
        6 |         [xs...]() -> decltype(f(xs...)) { };
        |                               ~^~~~~~~
    Compiler returned: 1

Reply via email to