https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125454
Bug ID: 125454
Summary: gcc: Segfault on templates
Product: gcc
Version: 17.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: lu.maltsis at postgrad dot manchester.ac.uk
Target Milestone: ---
```sh
$ gcc /tmp/bug.cpp
gcc: internal compiler error: Segmentation fault signal terminated program
cc1plus
Segmentation fault (core dumped)
$ cat /tmp/bug.cpp
template <typename, typename, typename, typename b>
void foo() {
b a = a[a];
}
int main() {
enum c {};
struct d;
union e;
foo<c, d, e, int[]>;
}
```
Compiler Explorer Reproducer: https://godbolt.org/z/W97TbdbGd
Exact version of gcc: trunk
[4cca035](https://github.com/gcc-mirror/gcc/commit/4cca035a0db7f6229b8ad4b09cde98f8d1969e8a)