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

--- Comment #5 from shyeyian <shyeyian at petalmail dot com> ---
Sorry that my problem and my previous explanation is wrong. Please look this
new example, thank you :)

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

===== b.cpp =====
export module b;
export import a; // **export import everything of a here!**
export namespace b { using namespace a; } // then export the name lookup

===== c.cpp =====
export module c;
import b;
static_assert(b::f() == 42); // (g++) error: ‘f’ is not a member of ‘b’

===== command =====
g++ -std=c++20 -fmodules -c a.cpp -o a.o
g++ -std=c++20 -fmodules -c b.cpp -o b.o 
g++ -std=c++20 -fmodules -c c.cpp -o c.o


=====
In b.cpp, what if we both
- export import the entities/symbols
- export the name lookup
Will a::f()/b::f() be visible in c.cpp?
g++ rejects this and clang++ accepts this, and I didn't know which is correct.

Reply via email to