In this testcase we get confused when looking at the sizeof... because the
argument pack for 'args' has been wrapped in an ARGUMENT_PACK_SELECT as part
of expanding the fold-expression. We handle this situation a bit lower down
in tsubst_pack_expansion, but that doesn't help the call to
argument_pack_element_is_expansion_p, which happens earlier.
* pt.c (argument_pack_element_is_expansion_p): Handle
ARGUMENT_PACK_SELECT.
From-SVN: r269776
2019-03-18 Jason Merrill <jason@redhat.com>
+ PR c++/89761 - ICE with sizeof... in pack expansion.
+ * pt.c (argument_pack_element_is_expansion_p): Handle
+ ARGUMENT_PACK_SELECT.
+
PR c++/89640 - GNU attributes on lambda.
* parser.c (cp_parser_lambda_declarator_opt): Allow GNU attributes.
static int
argument_pack_element_is_expansion_p (tree arg_pack, int i)
{
+ if (TREE_CODE (arg_pack) == ARGUMENT_PACK_SELECT)
+ /* We're being called before this happens in tsubst_pack_expansion. */
+ arg_pack = ARGUMENT_PACK_SELECT_FROM_PACK (arg_pack);
tree vec = ARGUMENT_PACK_ARGS (arg_pack);
if (i >= TREE_VEC_LENGTH (vec))
return 0;
--- /dev/null
+// PR c++/89761
+// { dg-do compile { target c++17 } }
+
+template <int...> struct seq {};
+template <bool> struct S {
+ template <typename Args>
+ constexpr static void call(Args&&...) {}
+};
+
+template <int ...Idx,typename ...Args>
+auto foo (seq<Idx...>, Args&& ...args) {
+ return (S<Idx==sizeof...(args)>::call(args), ...);
+}
+
+void bar() {
+ foo(seq<0,1,2>{}, 1,2,3);
+}