From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28830 invoked by alias); 23 Oct 2015 15:37:40 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 28809 invoked by uid 48); 23 Oct 2015 15:37:36 -0000 From: "vittorio.romeo at outlook dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/68071] New: Generic lambda variadic argument pack cannot be empty Date: Fri, 23 Oct 2015 15:37:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 5.2.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: vittorio.romeo at outlook dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2015-10/txt/msg01960.txt.bz2 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 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