<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/55065>55065</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
clang-13/14 crash when using virual consteval functions
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
ArXen42
</td>
</tr>
</table>
<pre>
### How to reproduce
```c++
struct Base
{
consteval virtual int Get() const = 0;
};
struct Derived : Base
{
consteval int Get() const override
{
return 42;
}
};
int main()
{
constexpr Derived a;
auto val = a.Get();
return 0;
}
```
Compiler explorer link (clang-14, -std=c++20, no optimizations or other options):
https://godbolt.org/z/vhqGqvf1z
Replacing 'consteval' with 'constexpr', moving `a` creation out of the function scope or removing inheritance seems to fix this compiler crash.
Attached cpp/sh crash reproduction files from my local compiler (clang 13.0.1-2 from Arch Linux repos):
[main-fee9e9..zip](https://github.com/llvm/llvm-project/files/8550155/main-fee9e9.zip)
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyVlM1y2yAUhZ9G2jDWSNiyzEILOx6ni6666hajK4sWgwJITvz0vWDZUTLNdDqDzN_lno8D-Giatzqhy1sh38yFeEMs9NY0g4Ak3yf5dvpd57ciEroLJY46bwfhyY67e3C1u69iwmjnYeSKjNL6AWupPXkGn9BNQhmJ8yRZ7kmeLO_Lqv17ey6xBytHaDB8-0-5v8mYEayVzWNPbL4UiwU_WE1WdCbPAs0XWEHjzKW-iXxF89rbBzn_lAGD-IB2B-JgAs8ezHOGCeyjRR-PZJ71yZx7qcAS1FbGYkNJ_ZtgXqG4Pi2KVUKfyML5BjWns6R5GNOGmN7Ls7xyL5GeGEuM7zBDGMaBCDbJdN73LvToAcvJNEejfGbsCXtX_Mbu5fllbIvrnO0H9IoLqU-IUz2OC9vkIn33PoiuYTswnc0Yw9c5x48IC5GNmAFPtCVIR9pBizjmhOkhQFuYlkmN9NJzLYA4gLMLt7uVr7hOOrwXk1PCctdlc9Ct91x0eGai73EzrrvFPF5G1GtxsSOtNWdyfiPKCDzHR86736RYZnlWLOgtcGtFR75LPbyGXOaDpUm5Cxdq0QIwYFl2lX1S7jHRJ6_RquGYoRJ2lBrv1QLRfoHAG3SIZFhvyjIvyhJb88QhL2VpUy8btmQ89dIrqKfbgf8Dh2I1bffSgSaDC1biCx7i_u5v7G67Swer6v9GlM4NkRER12Xa1cdqLSpRsragVDC-yQsQS1bmtF1jvypTxY-gXI0uJZRquJCYAttoUiprmlOar-iqqCjLNxlnrGqPVdU26xwo2ySrHNAElQWOcE9TW0ek43ByOKmk8-59kjsnTxogymF-fKidsfXW_gS9ommUriP6H3SzmNw">