aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2013-05-14 16:36:32 -0400
committerJason Merrill <jason@gcc.gnu.org>2013-05-14 16:36:32 -0400
commit71b04de2fb6c33227da78045728e52401081a759 (patch)
treef544ee90f4214df93972d07cf8987c7000777048 /gcc
parent2e55d0628102889d377feec36ca7699abd8afb1e (diff)
downloadgcc-71b04de2fb6c33227da78045728e52401081a759.zip
gcc-71b04de2fb6c33227da78045728e52401081a759.tar.gz
gcc-71b04de2fb6c33227da78045728e52401081a759.tar.bz2
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
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog3
-rw-r--r--gcc/cp/parser.c2
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/range-for25.C30
3 files changed, 34 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 1dae892c..aea304b 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,8 @@
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.
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index f65ec97..0a075b2 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -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);
diff --git a/gcc/testsuite/g++.dg/cpp0x/range-for25.C b/gcc/testsuite/g++.dg/cpp0x/range-for25.C
new file mode 100644
index 0000000..8ba9f65
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/range-for25.C
@@ -0,0 +1,30 @@
+// 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;
+}
+