From 2e5748d2868d1c8d24d84fe0bcf9916cf0ffc527 Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Sat, 13 Nov 2010 19:06:48 -0500 Subject: decl.c (cp_finish_decl): Use resolve_nondeduced_context for auto. * decl.c (cp_finish_decl): Use resolve_nondeduced_context for auto. * init.c (build_new): Likewise. * pt.c (tsubst_decl): Likewise. (do_auto_deduction): Likewise. (resolve_nondeduced_context): Use build_offset_ref and cp_build_addr_expr. From-SVN: r166724 --- gcc/cp/init.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'gcc/cp/init.c') diff --git a/gcc/cp/init.c b/gcc/cp/init.c index 00b5d9b..670c7a5 100644 --- a/gcc/cp/init.c +++ b/gcc/cp/init.c @@ -2516,8 +2516,13 @@ build_new (VEC(tree,gc) **placement, tree type, tree nelts, if (nelts == NULL_TREE && VEC_length (tree, *init) == 1) { tree auto_node = type_uses_auto (type); - if (auto_node && describable_type (VEC_index (tree, *init, 0))) - type = do_auto_deduction (type, VEC_index (tree, *init, 0), auto_node); + if (auto_node) + { + tree d_init = VEC_index (tree, *init, 0); + d_init = resolve_nondeduced_context (d_init); + if (describable_type (d_init)) + type = do_auto_deduction (type, d_init, auto_node); + } } if (processing_template_decl) -- cgit v1.1