https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120023
Nathaniel Shead <nshead at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Last reconfirmed| |2025-04-30 Ever confirmed|0 |1 CC| |nshead at gcc dot gnu.org Status|UNCONFIRMED |ASSIGNED Assignee|unassigned at gcc dot gnu.org |nshead at gcc dot gnu.org --- Comment #1 from Nathaniel Shead <nshead at gcc dot gnu.org> --- Confirmed. The issue is that because myclass is only an imported dependency in 'pm.deduction', we never walk it and so never build bindings for the deduction guides, causing name lookup to fail. There's not really a great workaround here that I could find, unfortunately, apart from perhaps turning your modules into partitions instead. The following patch I'm testing should solve the issue: diff --git a/gcc/cp/module.cc b/gcc/cp/module.cc index a2e0d6d2571..ae731906ca0 100644 --- a/gcc/cp/module.cc +++ b/gcc/cp/module.cc @@ -14825,6 +14825,9 @@ depset::hash::find_dependencies (module_state *module) if (!is_key_order () && DECL_CLASS_TEMPLATE_P (decl)) add_deduction_guides (decl); + if (!is_key_order () + && deduction_guide_p (decl)) + add_deduction_guides (TYPE_NAME (TREE_TYPE (TREE_TYPE (decl)))); if (!is_key_order () && TREE_CODE (decl) == TEMPLATE_DECL