public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/68071] New: Generic lambda variadic argument pack cannot be empty
@ 2015-10-23 15:37 vittorio.romeo at outlook dot com
  0 siblings, 0 replies; only message in thread
From: vittorio.romeo at outlook dot com @ 2015-10-23 15:37 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 68071
           Summary: Generic lambda variadic argument pack cannot be empty
           Product: gcc
           Version: 5.2.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: ---

struct C
{
    template<typename T, typename... TRest>
    auto operator()(T&& x, TRest&&...){ return x; }
};

int main()
{
    // Compiles both with clang and gcc.
    auto c = C{};
    c(1);

    // Compiles with clang 3.7.
    // Does not compile with gcc 5.2.
    auto l = [](auto&& x, auto&&...) { return x; };
    l(1);
}

decltype(l)::operator() should be equivalent to C::operator(), but if variadic
pack is left empty in the generic lambda, gcc refuses to compile:

15 : error: no match for call to '(main()::) (int)' l(1);
15 : note: candidate: decltype (((main()::)0u).main()::(x, )) (*)(auto:1&&,
auto:2&&, ...)

15 : note: candidate expects 3 arguments, 2 provided
14 : note: candidate: template main()::
auto l = [](auto&& x, auto&&...) { return x; };

14 : note: template argument deduction/substitution failed:
15 : note: candidate expects 2 arguments, 1 provided
l(1);

Live example on godbolt.org:
https://goo.gl/2ikAUK


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2015-10-23 15:37 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-23 15:37 [Bug c++/68071] New: Generic lambda variadic argument pack cannot be empty vittorio.romeo at outlook dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).