PR c++/72415 - member template with fold-expression constraint

* pt.c (tsubst_pack_expansion): Pull a single pack expansion out
	of the TREE_VEC.

From-SVN: r239138
This commit is contained in:
Jason Merrill 2016-08-04 12:06:22 -04:00 committed by Jason Merrill
parent 6a7b92036b
commit b9dc9ef63f
3 changed files with 31 additions and 0 deletions

View file

@ -1,5 +1,9 @@
2016-08-04 Jason Merrill <jason@redhat.com>
PR c++/72415
* pt.c (tsubst_pack_expansion): Pull a single pack expansion out
of the TREE_VEC.
* cp-tree.h (TYPE_UNNAMED_P): Rename from TYPE_ANONYMOUS_P.
(TYPE_WAS_UNNAMED): Rename from TYPE_WAS_ANONYMOUS.
* class.c, decl.c, decl2.c, error.c, lambda.c, mangle.c,

View file

@ -11160,6 +11160,12 @@ tsubst_pack_expansion (tree t, tree args, tsubst_flags_t complain,
local_specializations = saved_local_specializations;
}
/* If the dependent pack arguments were such that we end up with only a
single pack expansion again, there's no need to keep it in a TREE_VEC. */
if (len == 1 && TREE_CODE (result) == TREE_VEC
&& PACK_EXPANSION_P (TREE_VEC_ELT (result, 0)))
return TREE_VEC_ELT (result, 0);
return result;
}

View file

@ -0,0 +1,21 @@
// PR c++/72415
// { dg-options "-std=c++1z -fconcepts" }
template<int... Indices>
struct indices {};
template<typename Dummy>
struct foo_type {
template<int... Indices>
static void impl(indices<Indices...>)
requires (... && (Indices, true));
static auto caller()
{ return impl(indices<0, 1, 2> {}); }
};
int main()
{
// internal compiler error: in satisfy_predicate_constraint, at cp/constraint.cc:2013
foo_type<void>::caller();
}