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

--- Comment #7 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
The original test doesn't work with this patch because the
local_specialization_stack doesn't have "g" in it, because in
satisfy_declaration_constraints:

  if (tree norm = get_normalized_constraints_from_decl (t, info.noisy ())) 
    {    
      if (!push_tinst_level (t, orig_args))
        return result;
      tree pattern = DECL_TEMPLATE_RESULT (t); 
      push_to_top_level ();
      push_access_scope (pattern);
      {    
        /* For reconstruct_lambda_capture_pack.  */
        local_specialization_stack lss (LAMBDA_FUNCTION_P (t)
                                        ? lss_blank : lss_nop);
        result = satisfy_normalized_constraints (norm, args, info);
      }    
      pop_access_scope (pattern);
      pop_from_top_level ();
      pop_tinst_level ();
    }

push_to_top_level / lss_blank means that we have an empty
local_specialization_stack.  But we need foo<int>::g in it.

Reply via email to