commit 3d2892d25a37984099611c02614fc9788e14d4c4
Author: Jason Merrill <jason@redhat.com>
Date: Wed Nov 9 14:25:21 2011 -0500
PR c++/51046
* parser.c (cp_parser_range_for): check_for_bare_parameter_packs.
@@ -9292,6 +9292,8 @@ cp_parser_range_for (cp_parser *parser, tree scope, tree init, tree range_decl)
at instantiation. If not, it is done just ahead. */
if (processing_template_decl)
{
+ if (check_for_bare_parameter_packs (range_expr))
+ range_expr = error_mark_node;
stmt = begin_range_for_stmt (scope, init);
finish_range_for_decl (stmt, range_decl, range_expr);
if (!type_dependent_expression_p (range_expr)
new file mode 100644
@@ -0,0 +1,13 @@
+// PR c++/51046
+// { dg-do compile { target c++11 } }
+
+template<int... IS>
+void f()
+{
+ for (int i : IS); // { dg-error "not expanded" }
+}
+
+int main()
+{
+ f<0, 1, 2>();
+}