From d84572a4009158fe24931e2f8d8a7aa496d8a570 Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Mon, 20 Jun 2011 10:39:53 -0400 Subject: re PR c++/43321 ([c++0x] ICE on valid auto) PR c++/43321 * semantics.c (describable_type): Remove. * cp-tree.h: Likewise. * decl.c (cp_finish_decl): Don't call it. * init.c (build_new): Likewise. * parser.c (cp_parser_omp_for_loop): Likewise. * pt.c (tsubst_decl): Likewise. (do_auto_deduction): If we fail in a template, try again at instantiation time. From-SVN: r175212 --- gcc/cp/pt.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'gcc/cp/pt.c') diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 85f2749..6f15101 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -10122,11 +10122,8 @@ tsubst_decl (tree t, tree args, tsubst_flags_t complain) if (auto_node && init) { init = resolve_nondeduced_context (init); - if (describable_type (init)) - { - type = do_auto_deduction (type, init, auto_node); - TREE_TYPE (r) = type; - } + TREE_TYPE (r) = type + = do_auto_deduction (type, init, auto_node); } } else @@ -19302,6 +19299,12 @@ do_auto_deduction (tree type, tree init, tree auto_node) tree decl; int val; + if (processing_template_decl + && (TREE_TYPE (init) == NULL_TREE + || BRACE_ENCLOSED_INITIALIZER_P (init))) + /* Not enough information to try this yet. */ + return type; + /* The name of the object being declared shall not appear in the initializer expression. */ decl = cp_walk_tree_without_duplicates (&init, contains_auto_r, type); @@ -19331,6 +19334,9 @@ do_auto_deduction (tree type, tree init, tree auto_node) DEDUCE_CALL, LOOKUP_NORMAL); if (val > 0) { + if (processing_template_decl) + /* Try again at instantiation time. */ + return type; if (type && type != error_mark_node) /* If type is error_mark_node a diagnostic must have been emitted by now. Also, having a mention to '' -- cgit v1.1