From: Paolo Carlini Date: Mon, 25 Jul 2011 15:29:13 +0000 (+0000) Subject: re PR c++/49838 ([C++0x] ICE in cp_parser_perform_range_for_lookup, at cp/parser... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=c1703fc185b118903740257c9a8cd6e06fd562f1;p=gcc.git re PR c++/49838 ([C++0x] ICE in cp_parser_perform_range_for_lookup, at cp/parser.c:8796) /cp 2011-07-25 Paolo Carlini PR c++/49838 * parser.c (cp_parser_perform_range_for_lookup): Early return if error_operand_p (range). /testsuite 2011-07-25 Paolo Carlini PR c++/49838 * g++.dg/cpp0x/range-for19.C: New. From-SVN: r176754 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index a0f1f22bcdd..e1ff31134e2 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2011-07-25 Paolo Carlini + + PR c++/49838 + * parser.c (cp_parser_perform_range_for_lookup): Early return if + error_operand_p (range). + 2011-07-23 Jason Merrill PR c++/49823 diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index 4e7d905627a..c687a34e655 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -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 % expression of type %qT " diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index f0e66cf7c91..596ef6ae17d 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2011-07-25 Paolo Carlini + + PR c++/49838 + * g++.dg/cpp0x/range-for19.C: New. + 2011-07-25 Rainer Orth 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 index 00000000000..4306fbda6ce --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/range-for19.C @@ -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" } + ; +}