+2012-06-09 Jason Merrill <jason@redhat.com>
+
+ PR c++/53599
+ * name-lookup.c (pushtag_1): Add a DECL_EXPR for a local class.
+ * semantics.c (finish_cond): Build a COMPOUND_EXPR.
+ * pt.c (tsubst_expr) [COMPOUND_EXPR]: Handle.
+ [DECL_EXPR]: Don't call cp_finish_decl for an implicit typedef.
+ Don't return the decl.
+
2012-06-11 Richard Guenther <rguenther@suse.de>
PR c++/53605
class.) */
if (TYPE_CONTEXT (type)
&& TREE_CODE (TYPE_CONTEXT (type)) == FUNCTION_DECL)
- VEC_safe_push (tree, gc, local_classes, type);
+ {
+ if (processing_template_decl)
+ {
+ /* Push a DECL_EXPR so we call pushtag at the right time in
+ template instantiation rather than in some nested context. */
+ add_decl_expr (decl);
+ }
+ else
+ VEC_safe_push (tree, gc, local_classes, type);
+ }
}
if (b->kind == sk_class
&& !COMPLETE_TYPE_P (current_class_type))
DECL_CONTEXT (decl) = current_function_decl;
insert_capture_proxy (decl);
}
+ else if (DECL_IMPLICIT_TYPEDEF_P (t))
+ /* We already did a pushtag. */;
else
{
int const_init = false;
}
}
- /* A DECL_EXPR can also be used as an expression, in the condition
- clause of an if/for/while construct. */
- return decl;
+ break;
}
case FOR_STMT:
error ("use %<...%> to expand argument pack");
return error_mark_node;
+ case COMPOUND_EXPR:
+ tmp = RECUR (TREE_OPERAND (t, 0));
+ if (tmp == NULL_TREE)
+ /* If the first operand was a statement, we're done with it. */
+ return RECUR (TREE_OPERAND (t, 1));
+ return build_x_compound_expr (EXPR_LOCATION (t), tmp,
+ RECUR (TREE_OPERAND (t, 1)),
+ complain);
+
default:
gcc_assert (!STATEMENT_CODE_P (TREE_CODE (t)));
if (processing_template_decl)
{
tree cond = pop_stmt_list (*cond_p);
- if (TREE_CODE (cond) == DECL_EXPR)
- expr = cond;
- if (check_for_bare_parameter_packs (expr))
- *cond_p = error_mark_node;
+ if (expr == NULL_TREE)
+ /* Empty condition in 'for'. */
+ gcc_assert (empty_expr_stmt_p (cond));
+ else if (check_for_bare_parameter_packs (expr))
+ expr = error_mark_node;
+ else if (!empty_expr_stmt_p (cond))
+ expr = build2 (COMPOUND_EXPR, TREE_TYPE (expr), cond, expr);
}
*cond_p = expr;
}
+2012-06-07 Jason Merrill <jason@redhat.com>
+
+ PR c++/53599
+ * g++.dg/template/local7.C: New.
+
2012-06-12 Oleg Endo <olegendo@gcc.gnu.org>
PR target/53511
--- /dev/null
+// PR c++/53599
+
+template <typename T>
+int foo ()
+{
+ struct F;
+ struct G
+ {
+ static int F::* bar();
+ };
+
+ return sizeof(G);
+}
+
+int z = foo <int> ();