From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id F1BEF3858C53; Fri, 12 Jan 2024 09:16:39 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org F1BEF3858C53 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1705050999; bh=QA3MV79RUOAnwC1mm7ONgcS0s/IBt16PaEBxW7ShDEg=; h=From:To:Subject:Date:From; b=Hxz2BwLA9N00374xR/pqDPQmKQbJMJIcqJkkqWlgdJByi/4DIzDyzR33TI4DcpmCX 29SEX3/W0t3ACR4quXskUIX7lEplJtdF1XqAbT6edDuP1Bug3uGI7RgskIoye1u/Ud O5ickYV1caKazEwtwV64opAzGu0BlLAPNbSAtt24= From: "federico at kircheis dot it" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/113349] New: internal compiler error: in tsubst Date: Fri, 12 Jan 2024 09:16:38 +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: 14.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: federico at kircheis dot it 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=3D113349 Bug ID: 113349 Summary: internal compiler error: in tsubst Product: gcc Version: 14.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: federico at kircheis dot it Target Milestone: --- While trying to destructure a tuple, I got this internal compiler error ---- : In substitution of 'template template using types(), void()))>::el =3D std::tuple_element_= t())> [with long unsigned int N =3D 1; T =3D s]': :36:50: required from here 36 | static_assert(std::is_same_v::el<1>>); | ^ :7:28: internal compiler error: in tsubst, at cp/pt.cc:16312 7 | #define MAKE_TUPLE(V, ...) []{\ | ^~~~ 8 | auto [ __VA_ARGS__ ] =3D makeV(); \ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 9 | return std::make_tuple( __VA_ARGS__);\ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 10 | }() | ~=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20 :19:26: note: in expansion of macro 'MAKE_TUPLE' 19 | struct types { | ^~~~~~~~~~ 0x2640f8c internal_error(char const*, ...) ???:0 0xa502dd fancy_abort(char const*, int, char const*) ???:0 0xc92c62 tsubst(tree_node*, tree_node*, int, tree_node*) ???:0 0xca446c tsubst_lambda_expr(tree_node*, tree_node*, int, tree_node*) ???:0 0xc93417 tsubst(tree_node*, tree_node*, int, tree_node*) ???:0 0xc99729 tsubst_template_args(tree_node*, tree_node*, int, tree_node*) ???:0 0xc7c365 instantiate_template(tree_node*, tree_node*, int) ???:0 0xc9420c tsubst(tree_node*, tree_node*, int, tree_node*) ???:0 0xc914dc lookup_template_class(tree_node*, tree_node*, tree_node*, tree_nod= e*, int, int) ???:0 0xccd98f finish_template_type(tree_node*, tree_node*, int) ???:0 0xc51fda c_parse_file() ???:0 0xda59d9 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 ---- The code looks like ---- #include #include template V makeV(); #define MAKE_TUPLE(V, ...) []{\ auto [ __VA_ARGS__ ] =3D makeV(); \ return std::make_tuple( __VA_ARGS__);\ }() template struct types{ using type =3D void; }; template struct types { template using el =3D std::tuple_element_t; }; /* template struct types { template using el =3D std::tuple_element_t; }; */ struct s{ int& i; char* b; float f; }; //static_assert(std::is_same_v::el<0>>); // fails static_assert(std::is_same_v::el<1>>); static_assert(std::is_same_v::el<2>>); ---- This code compiles fine with clang and MSVC, and is, to the best of my knowledge, valid C++ Online example with latest gcc (and clang msvc too) https://godbolt.org/z/sPxK5avEW=