PR c++/89761 - ICE with sizeof... in pack expansion.
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
This commit is contained in:
parent
6e3587dbbc
commit
d849cfaeea
@ -1,5 +1,9 @@
|
||||
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.
|
||||
|
||||
|
@ -11544,6 +11544,9 @@ make_fnparm_pack (tree spec_parm)
|
||||
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;
|
||||
|
17
gcc/testsuite/g++.dg/cpp1z/fold10.C
Normal file
17
gcc/testsuite/g++.dg/cpp1z/fold10.C
Normal file
@ -0,0 +1,17 @@
|
||||
// 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);
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user