From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id C07ED3858CD1; Thu, 2 Nov 2023 19:01:19 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C07ED3858CD1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1698951679; bh=W06l6g+OaiUP0d21q3NeuXcJDmXKmr2yXziKnn32BEI=; h=From:To:Subject:Date:From; b=Ys7tsRKDNCMdrbL5EnXaSjImBT9nUMlB89OpcGKa5btY7SA6cjDn5ggogEGMrsCAp Ohw3g8/fKOtkf+X8/u7o7lV38Xkm4cz7WVUGGHyYey27JN35IWD4h9MmTxexoyGJdd N3O/rdoVs1Z61radxd2kan65i3B//zqxIS3ZMXog= From: "davidfromonline at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/112355] New: Internal compiler error when exporting using declaration of function template Date: Thu, 02 Nov 2023 19:01:19 +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=3D112355 Bug ID: 112355 Summary: Internal compiler error when exporting using declaration of function template 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 mostly valid code: ```cxx module; namespace n { template void f() { } } export module m; export using n::f; ``` causes gcc to crash with ```console :3:1: error: global module fragment contents must be from preproces= sor inclusion 3 | namespace n { | ^~~~~~~~~ :13:17: internal compiler error: tree check: expected none of template_decl, have template_decl in do_nonmember_using_decl, at cp/name-lookup.cc:4853 13 | export using n::f; | ^ 0x8fbb6e tree_not_check_failed(tree_node const*, char const*, int, char con= st*, ...) gcc/source/gcc/tree.cc:8986 0x76f1d4 tree_not_check(tree_node*, char const*, int, char const*, tree_cod= e) gcc/source/gcc/tree.h:3607 0x76f1d4 do_nonmember_using_decl gcc/source/gcc/cp/name-lookup.cc:4853 0xb63549 finish_nonmember_using_decl(tree_node*, tree_node*) gcc/source/gcc/cp/name-lookup.cc:6297 0xb6d974 finish_using_decl gcc/source/gcc/cp/parser.cc:21908 0xbb482f cp_parser_using_declaration gcc/source/gcc/cp/parser.cc:22072 0xbc8653 cp_parser_declaration gcc/source/gcc/cp/parser.cc:15335 0xbc85d4 cp_parser_module_export gcc/source/gcc/cp/parser.cc:15080 0xbc85d4 cp_parser_declaration gcc/source/gcc/cp/parser.cc:15276 0xbc908a cp_parser_toplevel_declaration gcc/source/gcc/cp/parser.cc:15356 0xbc908a cp_parser_translation_unit gcc/source/gcc/cp/parser.cc:5218 0xbc908a c_parse_file() gcc/source/gcc/cp/parser.cc:50627 0xd0f8e1 c_common_parse_file() gcc/source/gcc/c-family/c-opts.cc:1278 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: http://desktop:10240/z/nj5q1b (the crash still exists if the global module fragment comes from an #includ= e, I just made it this way to have a single-file reproduction)=