https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119763
Nathaniel Shead <nshead at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Ever confirmed|0 |1
Blocks| |103524
Status|UNCONFIRMED |ASSIGNED
Assignee|unassigned at gcc dot gnu.org |nshead at gcc dot
gnu.org
Last reconfirmed| |2025-04-12
--- Comment #1 from Nathaniel Shead <nshead at gcc dot gnu.org> ---
The following (untested) patch should fix the issue:
diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h
index 927f51b116b..0a52d333b8a 100644
--- a/gcc/cp/cp-tree.h
+++ b/gcc/cp/cp-tree.h
@@ -7539,7 +7539,7 @@ inline bool module_has_cmi_p ()
inline bool module_purview_p ()
{ return module_kind & MK_PURVIEW; }
inline bool module_attach_p ()
-{ return module_kind & MK_ATTACH; }
+{ return (module_kind & MK_ATTACH) && current_lang_depth () == 0; }
inline bool named_module_purview_p ()
{ return named_module_p () && module_purview_p (); }
Referenced Bugs:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103524
[Bug 103524] [meta-bug] modules issue