Hi again,

On 08/01/2012 08:40 PM, Paolo Carlini wrote:
For the second evaluation, the second time we call instantiate_template_1, thus for the interesting g(int) overload, here:

  spec = retrieve_specialization (gen_tmpl, targ_ptr, 0);

  gcc_assert (tmpl == gen_tmpl
          || ((fndecl = retrieve_specialization (tmpl, orig_args, 0))
          == spec)
          || fndecl == NULL_TREE);

  if (spec != NULL_TREE)
    {
      if (FNDECL_RECHECK_ACCESS_P (spec) && (complain & tf_error))
    recheck_decl_substitution (spec, gen_tmpl, targ_ptr);
      return spec;
    }

things are completely different, because spec != NULL_TREE and, more importantly, complain is tf_none, thus recheck_decl_substitution is not called, we just return immediately.
So, it is possible that when spec != NULL_TREE and we are once more in a SFINAE context, we have to actually call perform_deferred_access_checks (complain) and either return error_mark_node or the spec depending on the return value?

Paolo.

Reply via email to