From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 7E38A3858034; Tue, 6 Apr 2021 07:47:41 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7E38A3858034 From: "matthurd at acm dot org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/99926] New: Parameter packs and variadic arguments: Clang, gcc, and msvc differ on this one Date: Tue, 06 Apr 2021 07:47:41 +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: 11.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: matthurd at acm dot org 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: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Apr 2021 07:47:41 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D99926 Bug ID: 99926 Summary: Parameter packs and variadic arguments: Clang, gcc, and msvc differ on this one Product: gcc Version: 11.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: matthurd at acm dot org Target Milestone: --- I found three compiler differences from three compilers: https://godbolt.org/z/cEoYrn4T8 - two are wrong. g++ trunk and 10.2 affected. I thought gcc may be correct and clang may be incorrect in this compiler difference so I filed a bug with llvm. Richard Smith surmised gcc was incor= rect and clang is correct, so I have closed the clang bug and I'm opening a gcc = bug here if you'll indulge me. [Note: clang issue: https://bugs.llvm.org/show_bug.cgi?id=3D49852] ________________ gcc, clang, and msvc all compile this fun one: auto foo(auto......) { return 42; } int add_three() { return foo(3,4,5); } ____________________ But they argue about this curious one: [[nodiscard]] constexpr auto foo(auto...t...) noexcept {return (... + t);} int add_three() { return foo(3,4,5);} //gcc(7), clang(12), msvc(e= rr) int add_more() { return foo(3,4,5,6); } //gcc(18), clang(18), msvc(e= rr) https://godbolt.org/z/cEoYrn4T8 ____________________ It looks like gcc may be failing to extend the deduction as clang does. Like clang, EDG extends it as well, Richard reported. msvc will give the same an= swer as clang if auto is not used and it is a normal template expansion. This le= aves gcc as the outlier I guess. That gcc may be wrong makes sense, though it makes a C-style variadic after= a parameter pack unreachable which is a wee semantic whole in the grammar I guess. --Matt.=