[Bug c++/103313] New: nontype_argument_pack - compile error due to unsupported tree

ispavlick at gmail dot com gcc-bugzilla@gcc.gnu.org
Thu Nov 18 11:41:40 GMT 2021


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103313

            Bug ID: 103313
           Summary: nontype_argument_pack - compile error due to
                    unsupported tree
           Product: gcc
           Version: 11.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ispavlick at gmail dot com
  Target Milestone: ---

#include <array>
#include <tuple>
using namespace std;

struct Q {
    void set(int i) {}
};

template <int I>
struct S {
    Q mq[I];
    template <size_t ...num>
    void f(array<int, I> &a,
            index_sequence<num...> n=make_index_sequence<I>{}) {
        ((mq[num].set(a[num])), ...);
    }
};

int main() {
    S<3> s;
    array a{2, 5, 7};
    s.f(a); // error
    //s.f(a, make_index_sequence<3>{}); // ok

}

$ g++ 1.cpp -std=c++20
1.cpp: In member function ‘void S<I>::f(std::array<int, I>&,
std::index_sequence<num ...>) [with long unsigned int ...num = {}; int I = 3;
std::index_sequence<num ...> = std
::integer_sequence<long unsigned int>]’:
1.cpp:22:8: error: could not convert ‘std::make_index_sequence<3>{}’ from
‘integer_sequence<[...],‘nontype_argument_pack’ not supported by
dump_expr<expression error>>’ to 
integer_sequence<[...],‘nontype_argument_pack’ not supported by
dump_expr<expression error>>’
   22 |     s.f(a);
      |     ~~~^~~
      |        |
      |        integer_sequence<[...],‘nontype_argument_pack’ not supported by
dump_expr<expression error>>
1.cpp:22:8: note:   when instantiating default argument for call to ‘void
S<I>::f(std::array<int, I>&, std::index_sequence<num ...>) [with long unsigned
int ...num = {}; int
 I = 3; std::index_sequence<num ...> = std::integer_sequence<long unsigned
int>]’
1.cpp: In function ‘int main()’:
1.cpp:22:8: error: could not convert ‘std::make_index_sequence<3>{}’ from
‘integer_sequence<[...],‘nontype_argument_pack’ not supported by
dump_expr<expression error>>’ to 
integer_sequence<[...],‘nontype_argument_pack’ not supported by
dump_expr<expression error>>’


More information about the Gcc-bugs mailing list