aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/pt.c
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2011-06-20 10:39:53 -0400
committerJason Merrill <jason@gcc.gnu.org>2011-06-20 10:39:53 -0400
commitd84572a4009158fe24931e2f8d8a7aa496d8a570 (patch)
treeddd46f42a2c74e5fd3e577ca9e425f8c61baaaf8 /gcc/cp/pt.c
parent4b7d9ed4a8e049e777252718c4cddb85fece7cde (diff)
downloadgcc-d84572a4009158fe24931e2f8d8a7aa496d8a570.zip
gcc-d84572a4009158fe24931e2f8d8a7aa496d8a570.tar.gz
gcc-d84572a4009158fe24931e2f8d8a7aa496d8a570.tar.bz2
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
Diffstat (limited to 'gcc/cp/pt.c')
-rw-r--r--gcc/cp/pt.c16
1 files changed, 11 insertions, 5 deletions
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 '<type error>'