https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121702

            Bug ID: 121702
           Summary: [Modules] `using namespace` does not export.
           Product: gcc
           Version: 15.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: shyeyian at petalmail dot com
  Target Milestone: ---

===== a.cpp =====
module;
namespace x { constexpr int f() { return 42; } }

export module a;
export namespace a { using namespace x; } // Using everything in x.

static_assert(a::f() == 42); // We can use it here, because namespace a usings
all things in namespace x.

===== b.cpp =====
export module b;
import a;

static_assert(a::f() == 42); // We cannot use it here?

===== command =====
[anonymous@matebook anonymous]$ g++ -std=c++20 -fmodules -Wno-global-module -c
a.cpp -o a.o
[anonymous@matebook anonymous]$ g++ -std=c++20 -fmodules -Wno-global-module -c
b.cpp -o b.o
b.cpp:4:18: error: ‘f’ is not a member of ‘a’
    4 | static_assert(a::f() == 42);
      |

Reply via email to