PR c++/57243
* parser.c (cp_parser_range_for): Call complete_type.
From-SVN: r198901
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.
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);
--- /dev/null
+// 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;
+}
+