re PR c++/38639 (ICE with invalid use of auto in parallel for-loop)

PR c++/38639
	* pt.c (tsubst_omp_for_iterator): RECUR on whole init_expr instead of
	just its type.

	* g++.dg/gomp/pr38639.C: New test.

From-SVN: r142933
This commit is contained in:
Jakub Jelinek 2008-12-27 16:24:52 +01:00 committed by Jakub Jelinek
parent 382017a6e8
commit 749db154bd
4 changed files with 29 additions and 4 deletions

View file

@ -1,3 +1,9 @@
2008-12-27 Jakub Jelinek <jakub@redhat.com>
PR c++/38639
* pt.c (tsubst_omp_for_iterator): RECUR on whole init_expr instead of
just its type.
2008-12-21 Jason Merrill <jason@redhat.com>
PR c++/38597

View file

@ -10334,14 +10334,11 @@ tsubst_omp_for_iterator (tree t, int i, tree declv, tree initv,
if (auto_node && init)
{
tree init_expr = init;
tree orig_type;
if (TREE_CODE (init_expr) == DECL_EXPR)
init_expr = DECL_INITIAL (DECL_EXPR_DECL (init_expr));
orig_type = TREE_TYPE (init_expr);
TREE_TYPE (init_expr) = RECUR (TREE_TYPE (init_expr));
init_expr = RECUR (init_expr);
TREE_TYPE (decl)
= do_auto_deduction (TREE_TYPE (decl), init_expr, auto_node);
TREE_TYPE (init_expr) = orig_type;
}
gcc_assert (!type_dependent_expression_p (decl));

View file

@ -1,3 +1,8 @@
2008-12-27 Jakub Jelinek <jakub@redhat.com>
PR c++/38639
* g++.dg/gomp/pr38639.C: New test.
2008-12-23 Andrew Pinski <pinskia@gmail.com>
PR middle-end/38590

View file

@ -0,0 +1,17 @@
// PR c++/38639
// { dg-do compile }
// { dg-options "-fopenmp -std=c++0x" }
template<int> void
foo ()
{
#pragma omp parallel for
for (auto i = i = 0; i<4; ++i) // { dg-error "incomplete|unable|invalid" }
;
}
void
bar ()
{
foo<0> (); // { dg-message "instantiated from here" }
}