From 12f64ca5e16915c6d6b0079b0286cc8e6066975b Mon Sep 17 00:00:00 2001 From: Paolo Carlini Date: Fri, 4 Oct 2013 23:17:51 +0000 Subject: re PR c++/58503 ([c++11] ICE with invalid range in range-based for-loop) /cp 2013-10-04 Paolo Carlini PR c++/58503 * parser.c (cp_parser_perform_range_for_lookup): If eventually either *begin or *end is type-dependent, return NULL_TREE. (do_range_for_auto_deduction): If cp_parser_perform_range_for_lookup returns NULL_TREE, don't actually do_auto_deduction. /testsuite 2013-10-04 Paolo Carlini PR c++/58503 * g++.dg/cpp0x/range-for26.C: New. * g++.dg/cpp0x/range-for27.C: Likewise. From-SVN: r203219 --- gcc/testsuite/ChangeLog | 6 ++++++ gcc/testsuite/g++.dg/cpp0x/range-for26.C | 7 +++++++ gcc/testsuite/g++.dg/cpp0x/range-for27.C | 15 +++++++++++++++ 3 files changed, 28 insertions(+) create mode 100644 gcc/testsuite/g++.dg/cpp0x/range-for26.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/range-for27.C (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index dd34bc6..68d415e 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,11 @@ 2013-10-04 Paolo Carlini + PR c++/58503 + * g++.dg/cpp0x/range-for26.C: New. + * g++.dg/cpp0x/range-for27.C: Likewise. + +2013-10-04 Paolo Carlini + PR c++/58448 * g++.dg/template/crash117.C: New. diff --git a/gcc/testsuite/g++.dg/cpp0x/range-for26.C b/gcc/testsuite/g++.dg/cpp0x/range-for26.C new file mode 100644 index 0000000..71359cd --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/range-for26.C @@ -0,0 +1,7 @@ +// PR c++/58503 +// { dg-require-effective-target c++11 } + +template void foo() +{ + for (auto i : 0) {} // { dg-error "there are no arguments" } +} diff --git a/gcc/testsuite/g++.dg/cpp0x/range-for27.C b/gcc/testsuite/g++.dg/cpp0x/range-for27.C new file mode 100644 index 0000000..a9cfb8e --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/range-for27.C @@ -0,0 +1,15 @@ +// PR c++/58503 +// { dg-require-effective-target c++11 } +// { dg-options "-fpermissive -w" } + +struct c { }; + +template void foo() +{ + for (auto i : c()) { } +} + +c* begin(const c&); +c* end(const c&); + +template void foo<1>(); -- cgit v1.1