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

            Bug ID: 104390
           Summary: Tree check ICE for valid code
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: colavitam at gmail dot com
  Target Milestone: ---

The following code produces an ICE (-std=c++17):

template <typename T>
struct A {};

struct B {
    long v;
};

template<typename T, typename... F>
struct C {
template<F T::*... fields>
static void f(const A<T>& src) {}
};

void g() {
    C<B, long>::f<&B::v>({});
}

---

<source>: In function 'void g()':
<source>:15:25: internal compiler error: tree check: accessed elt 2 of
'tree_vec' with 0 elts in tsubst_pack_expansion, at cp/pt.cc:13125
   15 |     C<B, long>::f<&B::v>({});
      |     ~~~~~~~~~~~~~~~~~~~~^~~~

Reply via email to