From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 9B8953858D1E; Thu, 10 Nov 2022 20:16:01 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9B8953858D1E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1668111366; bh=0UUMJxevsrjrS7FohHYk/SIeZ/CQ5MTJpyraBIYzVbw=; h=From:To:Subject:Date:From; b=atmhJi/dIkP9FGdocKoSxhBdxEwwC1YnqRT0KQhUha5efYSQUS5LNiJVRtw3Toc6c lW3eIiNV+KAYaC8M51Ucplf/Tip6lqXod04kMMT4P6YWmN2GxVvgZLvRCbXRDHPUou +AlT+AdJQ2SJsPKsshAe98w2rUb+L0bQ1nMiz/K8= From: "jlaros at fixedpoint dot nl" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/107623] New: Using a parameter pack twice results in ambiguous overloaded function. Date: Thu, 10 Nov 2022 20:15:47 +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: 12.2.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: jlaros at fixedpoint dot nl 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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D107623 Bug ID: 107623 Summary: Using a parameter pack twice results in ambiguous overloaded function. Product: gcc Version: 12.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: jlaros at fixedpoint dot nl Target Milestone: --- The following example does not compile: template void test(R (*)(Args...), Args...) {} template void test(void (*)(Args...), Args...) {} int main() { void (*f)(int) {}; test(f, 1); } Example: $ g++ -Wall -Wextra -pedantic x.cc x.cc: In function =E2=80=98int main()=E2=80=99: x.cc:11:7: error: call of overloaded =E2=80=98test(void (*&)(int), int)= =E2=80=99 is ambiguous 11 | test(f, 1); | ~~~~^~~~~~ x.cc:2:6: note: candidate: =E2=80=98void test(R (*)(Args ...), Args ...= ) [with R =3D void; Args =3D {int}]=E2=80=99 2 | void test(R (*)(Args...), Args...) {} | ^~~~ x.cc:5:6: note: candidate: =E2=80=98void test(void (*)(Args ...), Args = ...) [with Args =3D {int}]=E2=80=99 5 | void test(void (*)(Args...), Args...) {} | ^~~~ This might be a bug because the following variants on the same theme do com= pile without errors or warnings: template void test(R (*)(T), T) {} template void test(void (*)(T), T) {} And: template void test(R (*)(FArgs...), Args...) {} template void test(void (*)(FArgs...), Args...) {} The first example does compile when using clang (version 14.0.6).=