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

--- Comment #8 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Alternative patch that I'm more happy about:

--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -28761,6 +28761,7 @@ build_deduction_guide (tree type, tree ctor, tree
outer_args, tsubst_flags_t com
   tree ded_fn = build_lang_decl_loc (loc,
                     FUNCTION_DECL,
                     dguide_name (type), fntype);
+  DECL_CONTEXT (ded_fn) = type;
   DECL_ARGUMENTS (ded_fn) = fargs;
   DECL_ARTIFICIAL (ded_fn) = true;
   DECL_NONCONVERTING_P (ded_fn) = explicit_p;

Reply via email to