http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16564

Manuel López-Ibáñez <manu at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dodji at gcc dot gnu.org

--- Comment #21 from Manuel López-Ibáñez <manu at gcc dot gnu.org> ---
> Still, making the "error: template instantiation depth exceeds maximum" a
> fatal error seems a good idea to me.

One issue face when implementing this is that the instantiation context is
printed after the whole error is given:

      if (TREE_CODE (d) == TREE_LIST)
        error ("template instantiation depth exceeds maximum of %d (use "
               "-ftemplate-depth= to increase the maximum) substituting %qS",
               max_tinst_depth, d);
      else
        error ("template instantiation depth exceeds maximum of %d (use "
               "-ftemplate-depth= to increase the maximum) instantiating %qD",
               max_tinst_depth, d);

      print_instantiation_context ();

If we convert the error to a fatal error, that information is lost. There
should be a way to tell a diagnostic function to call
print_instantiation_context (). We could override the diagnostic_finalizer like
we do for macro expansion, but it seems ugly to do this just here. I think it
would be better if there was some way to pass down flags to the finalizer to
control what to print.

Dodji, what do you think?

Reply via email to