[llvm-bugs] [Bug 49387] New: Pack expansion failure with template lambda and std::index_sequence

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Mar 1 19:01:18 PST 2021


https://bugs.llvm.org/show_bug.cgi?id=49387

            Bug ID: 49387
           Summary: Pack expansion failure with template lambda and
                    std::index_sequence
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++2a
          Assignee: unassignedclangbugs at nondot.org
          Reporter: vittorio.romeo at outlook.com
                CC: blitzrakete at gmail.com, erik.pilkington at gmail.com,
                    llvm-bugs at lists.llvm.org, richard-llvm at metafoo.co.uk

#include <utility>

struct S 
{
    template <int> using N = int;
    static constexpr int size = 5;
};

static void f()
{
    const auto l = [&]<typename>() {};

    [&]<std::size_t... Is>(std::index_sequence<Is...>)
    {
        ((l
                 .template operator()<typename S::template N<Is>>()),
            ...);
    }
    (std::make_index_sequence<S::size> {});
}

The code above results in an incorrect compilation failure with the following
message:

<source>:17:13: error: pack expansion does not contain any unexpanded parameter
packs
            ...);
            ^
1 error generated.
Compiler returned: 1

The code should instead compile. Live on Compiler Explorer:
https://gcc.godbolt.org/z/rMvY3o

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20210302/dd22a142/attachment.html>


More information about the llvm-bugs mailing list