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

            Bug ID: 83793
           Summary: Pack expansion outside of lambda containing the pack
                    incorrectly rejected
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: kretz at kde dot org
  Target Milestone: ---

Testcase (https://godbolt.org/g/mNhetZ):

#include <array>
#include <utility>

using std::size_t;
template <size_t... Indexes> auto f(std::index_sequence<Indexes...>) {
    std::array<int, sizeof...(Indexes)> x = {[&]() -> int { return Indexes;
}()...};
    return x;
}

auto g() {
    return f(std::make_index_sequence<3>());
}

The pack expansion of `[&]() -> int { return Indexes; }()` is apparently never
considered. ICC, clang, and MSVC accept the code.

Reply via email to