Bug 102869 - [11 Regression] Expansion pattern 'std::integer_sequence<long unsigned int, __integer_pack(int)(Is)...>' contains no parameter packs
Summary: [11 Regression] Expansion pattern 'std::integer_sequence<long unsigned int, _...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 12.0
: P2 normal
Target Milestone: 11.3
Assignee: Jason Merrill
URL:
Keywords: rejects-valid
Depends on:
Blocks:
 
Reported: 2021-10-21 07:29 UTC by 康桓瑋
Modified: 2022-04-12 20:24 UTC (History)
4 users (show)

See Also:
Host:
Target:
Build:
Known to work: 10.3.0
Known to fail: 11.1.0
Last reconfirmed: 2021-10-21 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description 康桓瑋 2021-10-21 07:29:56 UTC
[11 Regression]

#include <utility>

template<class...>
struct Tuple {};

template<std::size_t... Is>
using tuple_t = Tuple<std::make_index_sequence<Is>...>;

int main() {
  []<std::size_t... Is>(std::index_sequence<Is...>) {
    tuple_t<Is...> t;
  }(std::make_index_sequence<5>{});
}

https://godbolt.org/z/YKWEs5snW
Comment 1 Andrew Pinski 2021-10-21 08:44:07 UTC
Confirmed.
Comment 2 Patrick Palka 2021-11-04 19:08:35 UTC
Started with r11-7931.  Reduced rejects-valid testcase:


template<int...> struct integer_sequence;

template<int _Num>
using make_index_sequence = integer_sequence<__integer_pack(_Num)...>;

template<class...> struct Tuple;

template<int... Is> using tuple_t = Tuple<make_index_sequence<Is>...>;

template<int... Is>
void f() {
  tuple_t<Is...> t;
}
Comment 3 GCC Commits 2022-03-28 15:04:14 UTC
The master branch has been updated by Jason Merrill <jason@gcc.gnu.org>:

https://gcc.gnu.org/g:fc50d9a252c89c1bac78192bd0884ff23f2bf48b

commit r12-7857-gfc50d9a252c89c1bac78192bd0884ff23f2bf48b
Author: Jason Merrill <jason@redhat.com>
Date:   Fri Mar 25 13:13:35 2022 -0400

    c++: hash table ICE with variadic alias [PR105003]
    
    For PR104008 we thought it might be enough to keep strip_typedefs from
    removing this alias template specialization, but this PR demonstrates that
    other parts of the compiler also need to know to consider it dependent.
    
    So, this patch changes complex_alias_template_p to no longer consider
    template parameters used when their only use appears in a pack expansion,
    unless they are the parameter packs being expanded.
    
    To do that I also needed to change it to use cp_walk_tree instead of
    for_each_template_parm.  It occurs to me that find_template_parameters
    should probably also use cp_walk_tree, but I'm not messing with that now.
    
            PR c++/105003
            PR c++/104008
            PR c++/102869
    
    gcc/cp/ChangeLog:
    
            * pt.cc (complex_alias_template_r): walk_tree callback, replacing
            uses_all_template_parms_r, complex_pack_expansion_r.
            (complex_alias_template_p): Adjust.
            * tree.cc (strip_typedefs): Revert r12-7710 change.
    
    gcc/testsuite/ChangeLog:
    
            * g++.dg/cpp0x/variadic-alias6.C: New test.
            * g++.dg/cpp0x/variadic-alias7.C: New test.
Comment 4 GCC Commits 2022-04-12 20:14:41 UTC
The releases/gcc-11 branch has been updated by Jason Merrill <jason@gcc.gnu.org>:

https://gcc.gnu.org/g:00e7d6e66638b8d2d93ff6659a140f8b3cf37aeb

commit r11-9827-g00e7d6e66638b8d2d93ff6659a140f8b3cf37aeb
Author: Jason Merrill <jason@redhat.com>
Date:   Fri Mar 25 13:13:35 2022 -0400

    c++: hash table ICE with variadic alias [PR105003]
    
    For PR104008 we thought it might be enough to keep strip_typedefs from
    removing this alias template specialization, but this PR demonstrates that
    other parts of the compiler also need to know to consider it dependent.
    
    So, this patch changes complex_alias_template_p to no longer consider
    template parameters used when their only use appears in a pack expansion,
    unless they are the parameter packs being expanded.
    
    To do that I also needed to change it to use cp_walk_tree instead of
    for_each_template_parm.  It occurs to me that find_template_parameters
    should probably also use cp_walk_tree, but I'm not messing with that now.
    
            PR c++/105003
            PR c++/104008
            PR c++/102869
    
    gcc/cp/ChangeLog:
    
            * pt.c (complex_alias_template_r): walk_tree callback,  replacing
            uses_all_template_parms_r, complex_pack_expansion_r.
            (complex_alias_template_p): Adjust.
    
    gcc/testsuite/ChangeLog:
    
            * g++.dg/cpp0x/variadic-alias6.C: New test.
            * g++.dg/cpp0x/variadic-alias7.C: New test.
Comment 5 Jason Merrill 2022-04-12 20:24:38 UTC
Fixed for 11.3/12.