On Thu, Jul 7, 2016 at 2:23 PM, Jakub Jelinek <ja...@redhat.com> wrote: > On Thu, Jul 07, 2016 at 12:32:02PM -0400, Jason Merrill wrote: >> Hmm, I wonder if walk_tree_1 should walk into DECL_EXPR like it does into >> BIND_EXPR_VARS. But your patch is OK. > > Well, walk_tree_1 does walk into DECL_EXPR, but cp_genericize_r says > *walk_subtrees on the VAR_DECL inside of it. > When walking BIND_EXPR_VARS, it doesn't walk the vars themselves, but > /* Walk the DECL_INITIAL and DECL_SIZE. We don't want to walk > into declarations that are just mentioned, rather than > declared; they don't really belong to this part of the tree. > And, we can see cycles: the initializer for a declaration > can refer to the declaration itself. */ > WALK_SUBTREE (DECL_INITIAL (decl)); > WALK_SUBTREE (DECL_SIZE (decl)); > WALK_SUBTREE (DECL_SIZE_UNIT (decl)); > Do you mean walk_tree_1 should walk DECL_INITIAL/DECL_SIZE/DECL_SIZE_UNIT > of the var mentioned in the DECL_EXPR? Then for many vars (which are both > mentioned in BIND_EXPR_VARS and in DECL_EXPR) it would walk them twice.
Yes, that's what I meant. Or perhaps since this is a C++ FE issue, cp_walk_subtrees should walk those fields for artificial variables. Jason