From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 1F6063858021; Mon, 14 Mar 2022 14:26:11 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1F6063858021 From: "ed at catmur dot uk" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/69623] Invalid deduction of non-trailing template parameter pack Date: Mon, 14 Mar 2022 14:26:11 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 6.0 X-Bugzilla-Keywords: accepts-invalid X-Bugzilla-Severity: normal X-Bugzilla-Who: ed at catmur dot uk X-Bugzilla-Status: NEW 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: cc Message-ID: In-Reply-To: References: 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: Mon, 14 Mar 2022 14:26:11 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D69623 Ed Catmur changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |ed at catmur dot uk --- Comment #6 from Ed Catmur --- There is a fairly well-known idiom for extracting a specific element of an argument pack: auto f(auto..., auto a, auto...) { return a; } template struct any { any(auto) {} }; template auto g(std::index_sequence, auto... a) { return f...>(a...); } template auto h(auto... a) { return g(std::make_index_sequence(), a...); } I believe the intent of http://eel.is/c++draft/temp#param-14.sentence-3 is = that this idiom should work; per http://eel.is/c++draft/temp#param-example-7 (as= in comment #5) a function template secondary template parameter pack is only disallowed if it is nondeducible. In the original description of this tick= et (not comment #5, which I agree is disallowed) T is specifiable and U is deducible, so both are OK. > [...] A template parameter pack of a function template shall not be follo= wed by another template parameter unless that template parameter can be ded= uced from the parameter-type-list ([dcl.fct]) of the function template or h= as a default argument ([temp.deduct]). [...] Or is the intent that T must be explicitly specified, i.e. that f can be ca= lled as f<>() but not as f(), pace http://eel.is/c++draft/temp#arg.explicit-4.sentence-3 ? > If all of the template arguments can be deduced, they may all be omitted;= in this case, the empty template argument list <> itself may also be omitt= ed.=