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

--- Comment #4 from Pilar Latiesa <pilarlatiesa at gmail dot com> ---

I tried:

$ cat M.cpp

export module M;

export import :A;
export import :B;


$ cat A.cpp

export module M:A;

export class B;

export
class A
{
  void
  f(B const &) const;
};


$ cat B.cpp

export module M:B;

export class A;

export
class B
{
  void
  f(A const &) const;
};


$ cat A-impl.cpp

module M:A;

void
A::f(B const &) const {}


$ cat B-impl.cpp

module M:B;

void
B::f(A const &) const {}


and I got:

$ ../GCC-11/bin/g++ -fmodules-ts A.cpp B.cpp M.cpp A-impl.cpp B-impl.cpp
main.cpp -o foo
A-impl.cpp:5:1: error: ‘A’ has not been declared
    5 | A::f(B const &) const {}
      | ^
A-impl.cpp:5:1: error: variable or field ‘f’ declared void
A-impl.cpp:5:6: error: ‘B’ was not declared in this scope
    5 | A::f(B const &) const {}
      |      ^
A-impl.cpp:2:1: warning: not writing module ‘M:A’ due to errors
    2 | module M:A;
      | ^~~~~~
B-impl.cpp:5:1: error: ‘B’ has not been declared
    5 | B::f(A const &) const {}
      | ^
B-impl.cpp:5:1: error: variable or field ‘f’ declared void
B-impl.cpp:5:6: error: ‘A’ was not declared in this scope
    5 | B::f(A const &) const {}
      |      ^
B-impl.cpp:2:1: warning: not writing module ‘M:B’ due to errors
    2 | module M:B;
      | ^~~~~~

Reply via email to