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

            Bug ID: 110409
           Summary: ICE on explicit instantiation of undefined template
           Product: gcc
           Version: 12.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: stevenxia990430 at gmail dot com
  Target Milestone: ---

The following invalid program reports an internal compiler error: tree check:
accessed elt 2 of 'tree_vec' with 1 elts in tsubst, at cp/pt.cc:16072 on
gcc-trunk

To quickly reproduce: https://gcc.godbolt.org/z/4KcExh49f
```
template <typename E, typename F>
    struct expected3 {};
template <typename E>
    struct expected3<E, E>;
template <typename R, typename E>
    struct expected3<R, R> {};
template struct expected3<int, int>;

int main() {
    return 0;
}
```

Note after removing `template struct expected3<int, int>;` and this invalid
program:

```
template <typename E, typename F>
    struct expected3 {};
template <typename E>
    struct expected3<E, E>;
template <typename R, typename E>
    struct expected3<R, R> {};

int main() {
    return 0;
}
```
compiles successfully on gcc-trunk but is rejected on clang-trunk. See this
link: https://gcc.godbolt.org/z/9rP3vYW6o

Reply via email to