From 3fe98897323ab6672dcfb765272fbdb2bdab1015 Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Wed, 29 Jun 2011 17:19:22 -0400 Subject: 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 --- gcc/cp/pt.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'gcc/cp/pt.c') diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index d1d8336..dc6cd50 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -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 local_specializations, do perform auto deduction. */ tree auto_node = type_uses_auto (type); - tree init - = tsubst_expr (DECL_INITIAL (t), args, complain, in_decl, - /*constant_expression_p=*/false); - - if (auto_node && init) + if (auto_node) { + tree init + = tsubst_expr (DECL_INITIAL (t), args, complain, in_decl, + /*constant_expression_p=*/false); init = resolve_nondeduced_context (init); TREE_TYPE (r) = type = do_auto_deduction (type, init, auto_node); -- cgit v1.1