Commit 71b04de2 by Jason Merrill Committed by Jason Merrill

re PR c++/57243 (Using auto in range based for with templated container in…

re PR c++/57243 (Using auto in range based for with templated container in templated function requires extraneous template qualifier)

	PR c++/57243
	* parser.c (cp_parser_range_for): Call complete_type.

From-SVN: r198901
parent 2e55d062
2013-05-14 Jason Merrill <jason@redhat.com>
PR c++/57243
* parser.c (cp_parser_range_for): Call complete_type.
PR c++/57041
* pt.c (tsubst_copy_and_build): Don't recur into a designator.
......
......@@ -9735,7 +9735,7 @@ cp_parser_range_for (cp_parser *parser, tree scope, tree init, tree range_decl)
if (range_expr != error_mark_node
&& !type_dependent_expression_p (range_expr)
/* The length of an array might be dependent. */
&& COMPLETE_TYPE_P (TREE_TYPE (range_expr))
&& COMPLETE_TYPE_P (complete_type (TREE_TYPE (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);
......
// PR c++/57243
// { dg-require-effective-target c++11 }
struct snarf
{
template <class T>
void get() {}
};
template <class T>
struct container
{
snarf * begin() { return nullptr; }
snarf * end() { return nullptr; }
};
template <class T>
void foo()
{
container<int> arr;
for( auto i : arr )
i.get<int>();
}
int main()
{
return 0;
}
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