From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id D270B3858D34; Thu, 15 Aug 2024 12:10:59 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D270B3858D34 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1723723859; bh=/ATb+HwLwSrfCknDXX4BtMxFBa2Tqk2vpJMryLDjudI=; h=From:To:Subject:Date:From; b=y1nvH1aoSZFp6Kys2iZRJXWCTO58r3M/FstgfJmpaUg2krtK/P7zgGiBD/84TDuQX AR8NXl3KmLqAqcB6vL5Ih5FQ0LnF4x4UhckenodSRj6ipc1PqLSC6aUwlQO5t+69wB 8ktBG3HPTvNm3XDh9dS7IICG9LjXmI2TPz7Sdorg= From: "nshead at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/116382] New: [modules] Importing NTTP of template type causes recursive lazy load Date: Thu, 15 Aug 2024 12:10:59 +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: 15.0 X-Bugzilla-Keywords: rejects-valid X-Bugzilla-Severity: normal X-Bugzilla-Who: nshead at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: nshead at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status keywords bug_severity priority component assigned_to reporter blocked 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=3D116382 Bug ID: 116382 Summary: [modules] Importing NTTP of template type causes recursive lazy load Product: gcc Version: 15.0 Status: UNCONFIRMED Keywords: rejects-valid Severity: normal Priority: P3 Component: c++ Assignee: nshead at gcc dot gnu.org Reporter: nshead at gcc dot gnu.org Blocks: 103524 Target Milestone: --- Consider: // a.cpp module m:a; template struct X {}; template nttp> struct index {}; template struct index<{}>; // m.cpp export module m; import :a; With 'g++ -fmodules-ts -std=3Dc++20 -S a.cpp m.cpp': m.C:2:11: error: recursive lazy load 2 | import :a; | ^ m.C:2:11: fatal error: failed to load pendings for =E2=80=98::X=E2=80=99 compilation terminated. This error occurs even with '-fno-module-lazy'. The root cause seems to be= the following logic for streaming in NTTPs in 'trees_in::tree_node': case tt_nttp_var: /* An NTTP object. */ { tree init =3D tree_node (); tree name =3D tree_node (); if (!get_overrun ()) { res =3D get_template_parm_object (init, name); int tag =3D insert (res); dump (dumper::TREE) && dump ("Created nttp object:%d %N", tag, name); } } break; The call to 'get_template_parm_object' calls 'cp_finish_decl' which eventua= lly ends up performing name lookup on the as-yet unstreamed '::X' when processi= ng the initialiser, resulting in a call to 'lazy_load_pendings' which cannot be done during streaming. Referenced Bugs: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D103524 [Bug 103524] [meta-bug] modules issue=