Commit 0398c183 by Ryan Burn Committed by Jason Merrill

re PR c++/68396 (function auto-deduced return types get incorrectly classified as parameter packs)

	PR c++/68396

2015-11-19  Ryan Burn  <contact@rnburn.com>

	* pt.c (find_parameter_packs_r) [DECLTYPE_TYPE]: When traversing
	the DECLTYPE_TYPE_EXPR, set type_pack_expansion_p to false.

From-SVN: r230620
parent 498cb3c3
2015-11-19 Ryan Burn <contact@rnburn.com>
PR c++/68396
* pt.c (find_parameter_packs_r) [DECLTYPE_TYPE]: When traversing
the DECLTYPE_TYPE_EXPR, set type_pack_expansion_p to false.
2015-11-19 Cesar Philippidis <cesar@codesourcery.com>
* parser.h (struct cp_omp_declare_simd_data): Add clauses member.
......
......@@ -3551,6 +3551,20 @@ find_parameter_packs_r (tree *tp, int *walk_subtrees, void* data)
*walk_subtrees = 0;
return NULL_TREE;
case DECLTYPE_TYPE:
{
/* When traversing a DECLTYPE_TYPE_EXPR, we need to set
type_pack_expansion_p to false so that any placeholders
within the expression don't get marked as parameter packs. */
bool type_pack_expansion_p = ppd->type_pack_expansion_p;
ppd->type_pack_expansion_p = false;
cp_walk_tree (&DECLTYPE_TYPE_EXPR (t), &find_parameter_packs_r,
ppd, ppd->visited);
ppd->type_pack_expansion_p = type_pack_expansion_p;
*walk_subtrees = 0;
return NULL_TREE;
}
default:
return NULL_TREE;
}
......
// { dg-do compile { target c++14 } }
template <unsigned>
auto f () {
return 2;
}
template <class>
class A {};
template <int... Ix>
auto g () {
A<decltype(f<Ix> ())...>();
return f<2> ();
}
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