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
This commit is contained in:
Ryan Burn 2015-11-19 18:25:38 +00:00 committed by Jason Merrill
parent 498cb3c320
commit 0398c18360
3 changed files with 35 additions and 0 deletions

View file

@ -1,3 +1,9 @@
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.

View file

@ -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;
}

View file

@ -0,0 +1,15 @@
// { 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> ();
}