Commit 4b950a6d by Jason Merrill Committed by Jason Merrill

Avoid ICE on unsupported use of __integer_pack.

	* pt.c (tsubst_pack_expansion): Sorry rather than abort
	on __integer_pack as subexpression of pattern.

From-SVN: r260404
parent 7aed919c
2018-05-19 Jason Merrill <jason@redhat.com>
* pt.c (tsubst_pack_expansion): Sorry rather than abort
on __integer_pack as subexpression of pattern.
2018-05-18 Jason Merrill <jason@redhat.com> 2018-05-18 Jason Merrill <jason@redhat.com>
PR c++/58407 - deprecated implicit copy ops. PR c++/58407 - deprecated implicit copy ops.
......
...@@ -12067,8 +12067,13 @@ tsubst_pack_expansion (tree t, tree args, tsubst_flags_t complain, ...@@ -12067,8 +12067,13 @@ tsubst_pack_expansion (tree t, tree args, tsubst_flags_t complain,
} }
else if (builtin_pack_call_p (parm_pack)) else if (builtin_pack_call_p (parm_pack))
{ {
/* ??? Support use in other patterns. */ if (parm_pack != pattern)
gcc_assert (parm_pack == pattern); {
if (complain & tf_error)
sorry ("%qE is not the entire pattern of the pack expansion",
parm_pack);
return error_mark_node;
}
return expand_builtin_pack_call (parm_pack, args, return expand_builtin_pack_call (parm_pack, args,
complain, in_decl); complain, in_decl);
} }
......
// { dg-additional-options -std=c++17 }
template<int ... Ns> int f() { return (Ns + ...); }
template<int N> int g() {
return f<__integer_pack(N)...>(); // Fine.
}
template<int N> int h() {
return f<(2*__integer_pack(N))...>(); // { dg-bogus "sorry" "" { xfail *-*-* } }
}
int main() { return g<3>()+h<3>(); }
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