aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/pt.c
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2011-06-29 17:19:22 -0400
committerJason Merrill <jason@gcc.gnu.org>2011-06-29 17:19:22 -0400
commit3fe98897323ab6672dcfb765272fbdb2bdab1015 (patch)
treede9b852c9bb9dd444b2a9126987b7f662c2cf266 /gcc/cp/pt.c
parent4c2d93dbfaae5ec5a86d903cc1383c2558c0156e (diff)
downloadgcc-3fe98897323ab6672dcfb765272fbdb2bdab1015.zip
gcc-3fe98897323ab6672dcfb765272fbdb2bdab1015.tar.gz
gcc-3fe98897323ab6672dcfb765272fbdb2bdab1015.tar.bz2
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
Diffstat (limited to 'gcc/cp/pt.c')
-rw-r--r--gcc/cp/pt.c9
1 files changed, 4 insertions, 5 deletions
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);