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

            Bug ID: 68965
           Summary: `-Wunused-parameter` is reported in variadic lambda or
                    function using sizeof...(xs)
           Product: gcc
           Version: 5.3.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: vittorio.romeo at outlook dot com
  Target Milestone: ---

gcc.godbolt.org: https://goo.gl/oJf4gs

auto count = [](auto&&... xs)
{
    return sizeof...(xs);
};

struct count_struct
{
    template<typename... Ts>
    auto operator()(Ts&&... xs)
    {
        return sizeof...(xs);
    }
};

int main()
{
    count(1,2,3,4,5,6,7);
    count_struct{}(1,2,3,4,5,6,7);
}

Compile with `-Wunused-parameter -std=c++14`.

g++ 5.1.0 will produce no warnings.
g++ 5.2.0 will produce no warnings.
g++ 5.3.0 will produce warnings for both `count` and `count_struct`.

The warnings seem erroneous, as `xs` is being used inside `sizeof...`.

Reply via email to