From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 8E1283895FE9; Mon, 12 Dec 2022 06:11:30 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8E1283895FE9 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1670825490; bh=n4xePROnHcXBbnla8ewCOpSUJKxHDWjxMYBEOI3wxxM=; h=From:To:Subject:Date:From; b=lbduX8oVpBraZ5IdIK6+QsiiO3EusBlaPrfcY9F++m2f5i6efOIc0zGoVxfEKFbdt SuBhOF5sTnxpBp7tUjErKn8O6ikj8jPdzzXbCwWQWQbjDQ+vIC/hrfeoewHJKAmoq3 /C/hfZ7R7PiC1tZ0Akcfh7u2FQp+OFAJlUdC6PZ4= From: "danakj at orodu dot net" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/108067] New: Miscompilation with friend function with parameter pack: mismatched argument pack lengths Date: Mon, 12 Dec 2022 06:11:30 +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.1 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: danakj at orodu dot net 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=3D108067 Bug ID: 108067 Summary: Miscompilation with friend function with parameter pack: mismatched argument pack lengths Product: gcc Version: 12.2.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: danakj at orodu dot net Target Milestone: --- The following code compiles in Clang and MSVC but not in GCC. Repros in GCC 10, 11, 12, and trunk. ``` template static constexpr bool C =3D true; template struct Foo { template requires((... && C)) void bar(const Foo& r) {} template requires((... && C)) friend void baz(const Foo& l, const Foo& r) {} }; int main() { Foo x; x.bar(Foo()); // Works. baz(x, Foo()); // Doesn't work. } ``` godbolt: https://godbolt.org/z/3Ybofbcoc : In instantiation of 'struct Foo': :16:19: required from here :12:17: error: mismatched argument pack lengths while expanding 'C<= Ts, Us>' 12 | friend void baz(const Foo& l, const Foo& r) {} | ^~~ ASM generation compiler returned: 1 : In instantiation of 'struct Foo': :16:19: required from here :12:17: error: mismatched argument pack lengths while expanding 'C<= Ts, Us>' 12 | friend void baz(const Foo& l, const Foo& r) {} | ^~~ Execution build compiler returned: 1=