re PR c++/49838 ([C++0x] ICE in cp_parser_perform_range_for_lookup, at cp/parser...
authorPaolo Carlini <paolo.carlini@oracle.com>
Mon, 25 Jul 2011 15:29:13 +0000 (15:29 +0000)
committerPaolo Carlini <paolo@gcc.gnu.org>
Mon, 25 Jul 2011 15:29:13 +0000 (15:29 +0000)
/cp
2011-07-25  Paolo Carlini  <paolo.carlini@oracle.com>

PR c++/49838
* parser.c (cp_parser_perform_range_for_lookup): Early return if
error_operand_p (range).

/testsuite
2011-07-25  Paolo Carlini  <paolo.carlini@oracle.com>

PR c++/49838
* g++.dg/cpp0x/range-for19.C: New.

From-SVN: r176754

gcc/cp/ChangeLog
gcc/cp/parser.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp0x/range-for19.C [new file with mode: 0644]

index a0f1f22bcdd614ef4dd0b58433da4b065f6f3619..e1ff31134e21a6de883c447f8f757b4d17d953a9 100644 (file)
@@ -1,3 +1,9 @@
+2011-07-25  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       PR c++/49838
+       * parser.c (cp_parser_perform_range_for_lookup): Early return if
+       error_operand_p (range).
+
 2011-07-23  Jason Merrill  <jason@redhat.com>
 
        PR c++/49823
index 4e7d905627a1f8e484f9ca62d007d91bf2afcd5b..c687a34e655cd6a52a520c838f48804d1d8a5ff2 100644 (file)
@@ -8795,6 +8795,9 @@ cp_convert_range_for (tree statement, tree range_decl, tree range_expr)
 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 "
index f0e66cf7c916c4acd80305ab3a00d355f2747fe9..596ef6ae17d3d33e4253323be9768da9225daaad 100644 (file)
@@ -1,3 +1,8 @@
+2011-07-25  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       PR c++/49838
+       * g++.dg/cpp0x/range-for19.C: New.
+
 2011-07-25  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
 
        PR testsuite/49753
diff --git a/gcc/testsuite/g++.dg/cpp0x/range-for19.C b/gcc/testsuite/g++.dg/cpp0x/range-for19.C
new file mode 100644 (file)
index 0000000..4306fbd
--- /dev/null
@@ -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" }
+    ;
+}