<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/60505>60505</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
clang++-15 front end crash with segmentation fault
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
johanjoensson
</td>
</tr>
</table>
<pre>
The following code results in clang++-15 crashing with a segmentation fault. I am using clang/llvm installed from the Gentoo ebuild repository, the same error occurs with the clang/llvm version in the fedora 37 repositories. The same code compiles without problem using gcc-12.
How to reproduce:
compile with clang++ version 15 and the -std=c++2b flag
```c++
#include <functional>
template <typename a, typename b>
class c {
public:
c(a d, b e)
: l(d), g(e)
{}
void operator[](auto... h)
{
l[h...];
}
a l;
b g;
};
template <typename i, typename o>
auto j(i expr, o f)
{
return c(expr, f);
}
template <typename a>
auto operator-(a d)
{
return j(d, std::negate());
}
template <typename k>
class q {
public:
q()
: p()
{}
void operator[](size_t, size_t);
std::vector<k> p;
};
int main()
{
q<int> m;
auto n = -m;
n[0, 0];
}
```
The preprocessed code and runscript generated by clang are attached in the zip-archive.
[crash_report.zip](https://github.com/llvm/llvm-project/files/10576861/crash_report.zip)
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyUVU2T4ygM_TXkoorLgdhJDj50OpPdvc99CoNs04vBA7h7u3_9FhB3PmZnaqcqlQASek9PiuDeq94gNqQ6kuq04nMYrGte7MDNi0XjvTWr1sr35uuA0Fmt7ZsyPQgrERz6WQcPyoDQ3PSEHgk9rjcVCMf9EP3eVBiAg8d-RBN4UNZAx2cdCvgL-AizT9Hy7bPWryMo4wPXGiV0zo4QBoQ_0ARrAdtZaQkOJ-tVsO6d0Odk93xEQOesAyvE7HzGjaa70K_ofGSgTLJ1KK3jwHbXkAp9AV-XkClLYcdJacwx7RxgcrbVuHDvhVhvaEHKEymf8vef9g2CjUGdlbNA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