aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog3
-rw-r--r--gcc/cp/parser.c4
-rw-r--r--gcc/testsuite/ChangeLog2
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/range-for22.C5
4 files changed, 13 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 9bcec32..c349549 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,8 @@
2011-10-02 Jason Merrill <jason@redhat.com>
+ * parser.c (cp_parser_range_for): Don't try to deduce from {}
+ in a template.
+
PR c++/35722
Implement N2555 (expanding pack expansion to fixed parm list)
* pt.c (coerce_template_parms): Allow expanding a pack expansion
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index 83d7b71..cabe9aa 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -8688,7 +8688,9 @@ cp_parser_range_for (cp_parser *parser, tree scope, tree init, tree range_decl)
{
stmt = begin_range_for_stmt (scope, init);
finish_range_for_decl (stmt, range_decl, range_expr);
- if (!type_dependent_expression_p (range_expr))
+ if (!type_dependent_expression_p (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);
}
else
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 275b9b3..7a7794f 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,5 +1,7 @@
2011-10-02 Jason Merrill <jason@redhat.com>
+ * g++.dg/cpp0x/range-for22.C: New.
+
* g++.dg/cpp0x/variadic65.C: Remove xfails.
* g++.dg/cpp0x/variadic82.C: Remove xfails.
* g++.dg/cpp0x/variadic83.C: Remove xfails.
diff --git a/gcc/testsuite/g++.dg/cpp0x/range-for22.C b/gcc/testsuite/g++.dg/cpp0x/range-for22.C
new file mode 100644
index 0000000..5fef5e6
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/range-for22.C
@@ -0,0 +1,5 @@
+// { dg-options -std=c++0x }
+
+template<int I> void f() {
+ for (auto i: {I} );
+}