https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113129
Bug ID: 113129 Summary: "using declaration" not detected as "exported" in exported namespace Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: admin at hexadigm dot com Target Milestone: --- Hi there, See https://godbolt.org/z/MdToP8nP8 for a demo (self-explanatory and very short). GCC version fails in top window (see error there), while Clang succeeds in bottom window (also succeeds in MSVC - haven't test any others). Issue is that the "using" declaration seen in "Consts.cppm" compiles successfully but the variable being declared ("Test_v") isn't being exported even though its "Const" namespace is exported. "Test_v" is therefore inaccessible to any client that imports the "Consts" module (resulting in the GCC compiler error seen in the top window). I don't see any obvious reason why it shouldn't compile however unless it's a GCC bug (but like so many I'm new to modules and this particular construct is a fuzzy area - maybe Clang and MSVC got it wrong but read on). Please note that this technique is very useful since it allows existing C++ headers to be easily used in C++ modules without any changes to the headers themselves (so correcting it would be highly desirable to many). Users therefore have the choice to either #include the existing header ("Consts.h" in this example) or import the module instead ("Consts" in this example). The module just defers to the header itself by applying "using" declarations as seen in this example (to export whatever it needs from the header, in this case "Test_v").