summaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2013-04-01 17:18:05 -0400
committerJason Merrill <jason@gcc.gnu.org>2013-04-01 17:18:05 -0400
commit570e2ca01e8a80aadd18eb0b85c982077e76aef4 (patch)
tree95fd9ea2d5dcbf958c70ddc714c2b883948216a3 /gcc/cp
parent123d7a94342b49153722fe385b60dfd54a216aaa (diff)
downloadgcc-570e2ca01e8a80aadd18eb0b85c982077e76aef4.tar.gz
re PR c++/56794 (C++11 Error in range-based for with parameter pack array)
PR c++/56794 * parser.c (cp_parser_range_for): Don't try to do auto deduction in a template if the type of the range is incomplete. From-SVN: r197324
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/ChangeLog4
-rw-r--r--gcc/cp/parser.c5
2 files changed, 8 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index ac22dc23445..c7e140ed579 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,9 @@
2013-04-01 Jason Merrill <jason@redhat.com>
+ PR c++/56794
+ * parser.c (cp_parser_range_for): Don't try to do auto deduction
+ in a template if the type of the range is incomplete.
+
* call.c (add_function_candidate): Take the address of 'this' here.
(build_over_call): And here.
(build_new_method_call_1, build_op_call_1): Not here.
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index f29e80db7c5..05c03f45d27 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -9615,7 +9615,10 @@ cp_parser_range_for (cp_parser *parser, tree scope, tree init, tree range_decl)
range_expr = error_mark_node;
stmt = begin_range_for_stmt (scope, init);
finish_range_for_decl (stmt, range_decl, range_expr);
- if (!type_dependent_expression_p (range_expr)
+ if (range_expr != error_mark_node
+ && !type_dependent_expression_p (range_expr)
+ /* The length of an array might be dependent. */
+ && COMPLETE_TYPE_P (TREE_TYPE (range_expr))
/* do_auto_deduction doesn't mess with template init-lists. */
&& !BRACE_ENCLOSED_INITIALIZER_P (range_expr))
do_range_for_auto_deduction (range_decl, range_expr);