Commit 749db154 by Jakub Jelinek Committed by Jakub Jelinek

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
parent 382017a6
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> 2008-12-21 Jason Merrill <jason@redhat.com>
PR c++/38597 PR c++/38597
......
...@@ -10334,14 +10334,11 @@ tsubst_omp_for_iterator (tree t, int i, tree declv, tree initv, ...@@ -10334,14 +10334,11 @@ tsubst_omp_for_iterator (tree t, int i, tree declv, tree initv,
if (auto_node && init) if (auto_node && init)
{ {
tree init_expr = init; tree init_expr = init;
tree orig_type;
if (TREE_CODE (init_expr) == DECL_EXPR) if (TREE_CODE (init_expr) == DECL_EXPR)
init_expr = DECL_INITIAL (DECL_EXPR_DECL (init_expr)); init_expr = DECL_INITIAL (DECL_EXPR_DECL (init_expr));
orig_type = TREE_TYPE (init_expr); init_expr = RECUR (init_expr);
TREE_TYPE (init_expr) = RECUR (TREE_TYPE (init_expr));
TREE_TYPE (decl) TREE_TYPE (decl)
= do_auto_deduction (TREE_TYPE (decl), init_expr, auto_node); = do_auto_deduction (TREE_TYPE (decl), init_expr, auto_node);
TREE_TYPE (init_expr) = orig_type;
} }
gcc_assert (!type_dependent_expression_p (decl)); gcc_assert (!type_dependent_expression_p (decl));
......
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> 2008-12-23 Andrew Pinski <pinskia@gmail.com>
PR middle-end/38590 PR middle-end/38590
......
// 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" }
}
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