public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "nickbegg at gmail dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/115194] New: [modules] "reference to <symbol> is ambiguous" when multiple paths to same symbol exist through module Date: Wed, 22 May 2024 17:40:38 +0000 [thread overview] Message-ID: <bug-115194-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115194 Bug ID: 115194 Summary: [modules] "reference to <symbol> 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. 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=always -g -std=gnu++23 -MD -MT CMakeFiles/moduleMin.dir/main.cpp.o -MF CMakeFiles/moduleMin.dir/main.cpp.o.d -fmodules-ts -fmodule-mapper=CMakeFiles/moduleMin.dir/main.cpp.o.modmap -MD -fdeps-format=p1689r5 -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 ‘Thing’ 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: ‘class NS1::NS2::Thing@modA’ 5 | class Thing {}; | ^~~~~ /home/nick/src/moduleMin/clean.hpp:5:7: note: ‘class NS1::NS2::Thing@modA’
next reply other threads:[~2024-05-22 17:40 UTC|newest] Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top 2024-05-22 17:40 nickbegg at gmail dot com [this message] 2024-06-13 2:42 ` [Bug c++/115194] " jason at gcc dot gnu.org 2024-06-13 15:06 ` cvs-commit at gcc dot gnu.org 2024-06-13 15:11 ` jason at gcc dot gnu.org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-115194-4@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).