Commit 3fe98897 by Jason Merrill Committed by Jason Merrill

pt.c (tsubst_decl): In unevaluated operand, don't tsubst DECL_INITIAL unless our type use auto.

	* pt.c (tsubst_decl) [VAR_DECL]: In unevaluated operand,
	don't tsubst DECL_INITIAL unless our type use auto.

From-SVN: r175670
parent 4c2d93db
2011-06-29 Jason Merrill <jason@redhat.com> 2011-06-29 Jason Merrill <jason@redhat.com>
* pt.c (tsubst_decl) [VAR_DECL]: In unevaluated operand,
don't tsubst DECL_INITIAL unless our type use auto.
PR c++/49520 PR c++/49520
* semantics.c (constexpr_fn_retval): Handle CLEANUP_POINT_EXPR here. * semantics.c (constexpr_fn_retval): Handle CLEANUP_POINT_EXPR here.
(massage_constexpr_body): Not here. (massage_constexpr_body): Not here.
......
...@@ -10138,12 +10138,11 @@ tsubst_decl (tree t, tree args, tsubst_flags_t complain) ...@@ -10138,12 +10138,11 @@ tsubst_decl (tree t, tree args, tsubst_flags_t complain)
scope, such as for a lambda return type. Don't add it to scope, such as for a lambda return type. Don't add it to
local_specializations, do perform auto deduction. */ local_specializations, do perform auto deduction. */
tree auto_node = type_uses_auto (type); tree auto_node = type_uses_auto (type);
tree init if (auto_node)
= tsubst_expr (DECL_INITIAL (t), args, complain, in_decl,
/*constant_expression_p=*/false);
if (auto_node && init)
{ {
tree init
= tsubst_expr (DECL_INITIAL (t), args, complain, in_decl,
/*constant_expression_p=*/false);
init = resolve_nondeduced_context (init); init = resolve_nondeduced_context (init);
TREE_TYPE (r) = type TREE_TYPE (r) = type
= do_auto_deduction (type, init, auto_node); = do_auto_deduction (type, init, auto_node);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment