From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 1CA2038582BE; Wed, 23 Nov 2022 23:39:31 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1CA2038582BE DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1669246771; bh=scanT04n6+rs9nytoey/6TjrRcxUiKfxieZNRM9N9N0=; h=From:To:Subject:Date:From; b=mt4T1llR9eyXTkS1pk4ymUS2xWoMCOTAnJTsqe9U1um3O01Y4sB1UYLOI0KIfXzhC jG5T/eaRDSs9O4WPhyHr4ZzlEwDK6ZkBr3vBXvxJpVgsMM2pNr2QXbpO3c2tT9SJ9S 4EdIyq+IQO66AB7rJCvsAwKTJ3QXVdz/rpCFUoT4= From: "davidfromonline at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/107853] New: Cannot create friend function template with variadic pack that depends on variadic pack Date: Wed, 23 Nov 2022 23:39: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: unknown X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: davidfromonline at gmail 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: 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=3D107853 Bug ID: 107853 Summary: Cannot create friend function template with variadic pack that depends on variadic pack Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: davidfromonline at gmail dot com Target Milestone: --- The following valid translation unit ``` template concept c =3D true; template struct s { template requires (... and c) friend void f(Us...) { } }; auto x =3D s<>(); ``` is rejected by gcc with the error message ``` : In instantiation of 'struct s<>': :11:14: required from here :6:27: error: mismatched argument pack lengths while expanding 'c' 6 | template... Us> | ^~ Compiler returned: 1 ``` See it live: https://godbolt.org/z/4qGKP9K9a Note that adding a single template parameter to the instantiated `s`, for instance, `s`, causes gcc to ICE: ``` template concept c =3D true; template struct s { template requires (... and c) friend void f(Us...) { } }; auto x =3D s(); ``` ``` : In instantiation of 'struct s': :11:17: required from here :6:52: internal compiler error: in use_pack_expansion_extra_args_p,= at cp/pt.cc:12674 6 | template requires (... and c) | ~~~~~~~~~^~~~~~~~~~ 0x22f921e internal_error(char const*, ...) ???:0 0xa4d7bc fancy_abort(char const*, int, char const*) ???:0 0xac1bb0 tsubst_constraint(tree_node*, tree_node*, int, tree_node*) ???:0 0xac1c99 maybe_substitute_reqs_for(tree_node*, tree_node const*) ???:0 0xc7e28c instantiate_class_template(tree_node*) ???:0 0xccdb7f complete_type_or_maybe_complain(tree_node*, tree_node*, int) ???:0 0xcef1a8 build_functional_cast(unsigned int, tree_node*, tree_node*, int) ???:0 0xc26267 c_parse_file() ???:0 0xd61389 c_common_parse_file() ???:0 Please submit a full bug report, with preprocessed source (by using -freport-bug). Please include the complete backtrace with any bug report. See for instructions. Compiler returned: 1 ``` See it live: https://godbolt.org/z/3dfvb5ov3 Using terse syntax (`template... Us>`) has the same behavior.=