Commit fcbc2bed by Jason Merrill Committed by Jason Merrill

re PR c++/49983 ([C++0x] Template types fail in range-based for.)

	PR c++/49983
	* parser.c (cp_parser_range_for): Only do auto deduction in
	template if the range is non-dependent.

From-SVN: r177478
parent a0348261
2011-08-05 Jason Merrill <jason@redhat.com> 2011-08-05 Jason Merrill <jason@redhat.com>
PR c++/49983
* parser.c (cp_parser_range_for): Only do auto deduction in
template if the range is non-dependent.
* init.c (perform_member_init): Always build_aggr_init * init.c (perform_member_init): Always build_aggr_init
for a class member with an explicit mem-initializer. for a class member with an explicit mem-initializer.
......
...@@ -8679,7 +8679,8 @@ cp_parser_range_for (cp_parser *parser, tree scope, tree init, tree range_decl) ...@@ -8679,7 +8679,8 @@ cp_parser_range_for (cp_parser *parser, tree scope, tree init, tree range_decl)
{ {
stmt = begin_range_for_stmt (scope, init); stmt = begin_range_for_stmt (scope, init);
finish_range_for_decl (stmt, range_decl, range_expr); finish_range_for_decl (stmt, range_decl, range_expr);
do_range_for_auto_deduction (range_decl, range_expr); if (!type_dependent_expression_p (range_expr))
do_range_for_auto_deduction (range_decl, range_expr);
} }
else else
{ {
......
2011-08-05 Jason Merrill <jason@redhat.com> 2011-08-05 Jason Merrill <jason@redhat.com>
PR c++/49983
* g++.dg/cpp0x/range-for21.C: New.
* g++.dg/ext/vla11.C: New. * g++.dg/ext/vla11.C: New.
2011-08-05 Richard Guenther <rguenther@suse.de> 2011-08-05 Richard Guenther <rguenther@suse.de>
......
// PR c++/49983
// { dg-options -std=c++0x }
template <class T>
void f(T t)
{
for (auto v : t);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment