<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/58247>58247</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Clang allows consteval constructor to be created on heap
</td>
</tr>
<tr>
<th>Labels</th>
<td>
c++20,
clang:diagnostics,
consteval
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
phyBrackets
</td>
</tr>
</table>
<pre>
`struct A {
consteval A() {}
};
int main() {
new A{};
}`
using `consteval` make `A::A()` an immediate function and `new` is not a way to call immediate function. This behaviour is false by other compilers (gcc/msvc) but it accepted by clang as it requires diagnostic .
https://godbolt.org/z/fdPPxTjPM
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJxtUk2TmzAM_TXm4lnGmBDgwCHZzN46k8P-AX8I8K7B1DZJ019fmWyzmU4ZA7L0JL0nWzp968iehehXFemBkvpI7w9hJ8IOyVJuDhEuwtID4Q3hbUKR-nRHJKM8ftnb18yRTsLMT-BHrRmuWOWe_shCe8_oc4k1mHmg6H30TohJfEJyHkiZ1hebFBEzNdME2ogItF9nFY2b0asTHHsmjAl0dpEKehU3Gh1Vwtr_ZOX0fUSohFFcjFt9yuuFDUDljbo4gseBTIux4ANFBoNShL9N4aKSWLlGarCJUrBE0ClHWYFaREh-Dz9X4yFQ7DnMLkSjaP6lfIxxCUkZf8M1OC2djbnzA-5-49vr8_nX-8f5B82gK_b7iu-Lomgy3ZW6LVuRRRMtdK_3dta6a3g6us1Kh-x8Ei-BKg8iUcRBjSCWbPW2-4eDieMqc5SLG2svf38vi3cfoCJuTQgrBDSqhu_qbOwa1u5U1Vctl3Uha1mJloHeFW0FutTlLrNCgg0dqY6Ec5wZ_o6coU34K02uxB8pfE8oPAUf1wFd1SkzHWecF4w1nJVFVeei5WWhOdRN33DeA9kxwLto88Q7DTPz3SZBrkPAoDUhhu-gCMEMM8BGD-uLNY7Od8t4O3qhPiGGbFPcbXL_AOW1_ww">