public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/103313] New: nontype_argument_pack - compile error due to unsupported tree
@ 2021-11-18 11:41 ispavlick at gmail dot com
  2021-11-19 10:55 ` [Bug c++/103313] " marxin at gcc dot gnu.org
  0 siblings, 1 reply; 2+ messages in thread
From: ispavlick at gmail dot com @ 2021-11-18 11:41 UTC (permalink / raw)
  To: gcc-bugs

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>>’

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Bug c++/103313] nontype_argument_pack - compile error due to unsupported tree
  2021-11-18 11:41 [Bug c++/103313] New: nontype_argument_pack - compile error due to unsupported tree ispavlick at gmail dot com
@ 2021-11-19 10:55 ` marxin at gcc dot gnu.org
  0 siblings, 0 replies; 2+ messages in thread
From: marxin at gcc dot gnu.org @ 2021-11-19 10:55 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2021-11-19
                 CC|                            |marxin at gcc dot gnu.org
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1

--- Comment #1 from Martin Liška <marxin at gcc dot gnu.org> ---
Confirmed.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-11-19 10:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-18 11:41 [Bug c++/103313] New: nontype_argument_pack - compile error due to unsupported tree ispavlick at gmail dot com
2021-11-19 10:55 ` [Bug c++/103313] " marxin at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).