Hi,
I have this patchlet for an ICE after error on invalid. Is it OK?
Tested x86_64-linux.
Paolo.
////////////////////////
/cp
2011-07-25 Paolo Carlini <[email protected]>
PR c++/49838
* parser.c (cp_parser_perform_range_for_lookup): Early return if
error_operand_p (range).
/testsuite
2011-07-25 Paolo Carlini <[email protected]>
PR c++/49838
* g++.dg/cpp0x/range-for19.C: New.
Index: gcc/testsuite/g++.dg/cpp0x/range-for19.C
===================================================================
--- gcc/testsuite/g++.dg/cpp0x/range-for19.C (revision 0)
+++ gcc/testsuite/g++.dg/cpp0x/range-for19.C (revision 0)
@@ -0,0 +1,11 @@
+// PR c++/49838
+
+// { dg-do compile }
+// { dg-options "-std=c++0x" }
+
+int main()
+{
+ auto a; // { dg-error "no initializer" }
+ for(auto i: a) // { dg-error "deduce" }
+ ;
+}
Index: gcc/cp/parser.c
===================================================================
--- gcc/cp/parser.c (revision 176718)
+++ gcc/cp/parser.c (working copy)
@@ -8793,6 +8793,9 @@ cp_convert_range_for (tree statement, tree range_d
static tree
cp_parser_perform_range_for_lookup (tree range, tree *begin, tree *end)
{
+ if (error_operand_p (range))
+ return error_mark_node;
+
if (!COMPLETE_TYPE_P (complete_type (TREE_TYPE (range))))
{
error ("range-based %<for%> expression of type %qT "