https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122785
--- Comment #4 from Nathaniel Shead <nshead at gcc dot gnu.org> ---
Somewhat minimised:
// a.h
struct S {
friend S foo();
S bar(int);
};
inline S s;
template <typename T> decltype(s.bar(T{})) foo(T);
// b.cpp
import "a.h";
$ g++ -fmodules -freflection -S a.h b.cpp
b.cpp:2:9: error: recursive lazy load
2 | using ::S;
| ^
b.cpp:2:9: fatal error: failed to load pendings for ā::Sā
compilation terminated.
What happens here is that the friend declaration forces all of these entities
into the same depset, and it so happens we don't have a complete definition of
'struct ::S' yet before we start reading the definition of '::s'.