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

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
So, when value_dependent_expression is called on the VAR_DECL i,
it (since the above mentioned change) recurse on its DECL_INITIAL:
      if (DECL_INITIAL (expression)
          && decl_constant_var_p (expression)
          && (TREE_CODE (DECL_INITIAL (expression)) == TREE_LIST
              /* cp_finish_decl doesn't fold reference initializers.  */
              || TREE_CODE (TREE_TYPE (expression)) == REFERENCE_TYPE
              || value_dependent_expression_p (DECL_INITIAL (expression))))
        return true;
then when seeing the SIZEOF_EXPR in there we do:
      return instantiation_dependent_expression_p (expression);
on the SIZEOF_EXPR's operand (which is VAR_DECL i), and
instantiation_dependent_r for VAR_DECL just calls value_dependent_expression
again, which closes the infinite recursion.  So we need to break the recursion
somewhere, perhaps by remembering in which VAR_DECL initializers we are already
in, or by temporarily clearing the DECL_INITIALIZER of the VAR_DECLs we are
recursing into, whatever.  Jason, any thoughts on this?

Reply via email to