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

            Bug ID: 89761
           Summary: [9.0 Regression] ICE: tree check: expected class
                    'expression', have 'exceptional'
                    (argument_pack_select)
           Product: gcc
           Version: 9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: leni536 at gmail dot com
  Target Milestone: ---

The following code triggers an ICE in g++ 9.0.1:

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);
}

I'm not sure about the validity of the code above.

Tested on godbolt.org with "-std=c++17" flag:

<source>: In instantiation of 'auto foo(seq<Idx ...>, Args&& ...) [with int
...Idx = {0, 1, 2}; Args = {int, int, int}]':
<source>:13:28:   required from here
<source>:9:20: internal compiler error: tree check: expected class
'expression', have 'exceptional' (argument_pack_select) in tree_operand_check,
at tree.h:3674
    9 |     return (S<Idx==sizeof...(args)>::call(args), ...);
      |                    ^~~~~~~~~~~~~~~
Please submit a full bug report,
with preprocessed source if appropriate.
See <https://gcc.gnu.org/bugs/> for instructions.

Version:
g++ (Compiler-Explorer-Build) 9.0.1 20190316 (experimental)

Reply via email to