From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id A0C13384F4BC; Wed, 22 May 2024 17:40:38 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A0C13384F4BC DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1716399638; bh=p6pWI5jsGuDqlC8Trc3Nn19yvsAjk978PX4VmTjJJt8=; h=From:To:Subject:Date:From; b=lra0rytMRejykU5InquvVPJI/r6rlL6/BplCg1RZW79x7YGS/1uICjHh3c5iQ8e4Z lMsv/WAQHKIaI1fKu70O2wsD/KZqG4KJm3j00KTdX/ID/fM/mBZ+ebrsIdlDGDVujQ PtC7McAJenSe5/sTd86CmPeXq1oztzFSnsEz+iIU= From: "nickbegg at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/115194] New: [modules] "reference to is ambiguous" when multiple paths to same symbol exist through module Date: Wed, 22 May 2024 17:40: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: 15.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: nickbegg 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=3D115194 Bug ID: 115194 Summary: [modules] "reference to is ambiguous" when multiple paths to same symbol exist through module Product: gcc Version: 15.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: nickbegg at gmail dot com Target Milestone: --- This code example was reduced from Boost's multi_index_container. When referencing symbols via modules and using statements, gcc gets tripped= up with different routes to the same symbol.=20 When #including clean.hpp directly into main.cpp, this compiles ok.: /// clean.hpp : namespace NS1 { namespace NS2 { class Thing {}; } // NS2 using NS2::Thing; } // NS1 /// modA.mpp: module; #include "clean.hpp" export module modA; export namespace NS1 { using ::NS1::Thing; namespace NS2 { } } /// main.cpp: #if 0 #include "clean.hpp" #else import modA; #endif using NS1::Thing; using namespace NS1::NS2; Thing thing; /// Tested with gcc trunk / 15.0.0 20240522 (revid 1a5e4dd83788ea4c049d354d83ad58a6a3d747e6) /home/nick/inst/gcc-trunk-debug/bin/g++ -fdiagnostics-color=3Dalways -g -std=3Dgnu++23 -MD -MT CMakeFiles/moduleMin.dir/main.cpp.o -MF CMakeFiles/moduleMin.dir/main.cpp.o.d -fmodules-ts -fmodule-mapper=3DCMakeFiles/moduleMin.dir/main.cpp.o.modmap -MD -fdeps-format=3Dp1689r5 -x c++ -o CMakeFiles/moduleMin.dir/main.cpp.o -c /home/nick/src/moduleMin/main.cpp /home/nick/src/moduleMin/main.cpp:9:1: error: reference to =E2=80=98Thing= =E2=80=99 is ambiguous 9 | Thing thing; | ^~~~~ In file included from /home/nick/src/moduleMin/modA.mpp:3, of module modA, imported at /home/nick/src/moduleMin/main.cpp:4: /home/nick/src/moduleMin/clean.hpp:5:7: note: candidates are: =E2=80=98class NS1::NS2::Thing@modA=E2=80=99 5 | class Thing {}; | ^~~~~ /home/nick/src/moduleMin/clean.hpp:5:7: note: =E2=80=98class NS1::NS2::Thing@modA=E2=80=99=