------- Comment #14 from rguenth at gcc dot gnu dot org 2009-07-24 19:59 ------- Index: cp/cp-gimplify.c =================================================================== --- cp/cp-gimplify.c (revision 150041) +++ cp/cp-gimplify.c (working copy) @@ -804,10 +804,14 @@ cp_genericize_r (tree *stmt_p, int *walk } }
- else if (TREE_CODE (stmt) == BIND_EXPR) + else if (TREE_CODE (stmt) == BIND_EXPR + /* We walk this twice, once to keep track of the BIND_EXPR + stack and once to properly walk the BIND_EXPR vars. */ + && (VEC_empty (tree, wtd->bind_expr_stack) + || VEC_last (tree, wtd->bind_expr_stack) != stmt)) { VEC_safe_push (tree, heap, wtd->bind_expr_stack, stmt); - cp_walk_tree (&BIND_EXPR_BODY (stmt), + cp_walk_tree (stmt_p, cp_genericize_r, data, NULL); VEC_pop (tree, wtd->bind_expr_stack); *walk_subtrees = 0; in case you want to do some testing. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40834