<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/115658>115658</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Constructing, destructing and returning a value of arbitrary type T causes static assertion failure inside LLVM's frontend
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
TymianekPL
</td>
</tr>
</table>
<pre>
Program: x86-64 clang 19.1.0 (assertions)
Example: [Compiler Explorer](https://godbolt.org/z/PWKsa6Tfc)
Log (same output inside the CE link above): [clang-log.txt](https://github.com/user-attachments/files/17691513/clang-log.txt)
Given the code:
```cpp
void nop(void) noexcept
{
typedef int T;
return T{}.~T();
}```
LLVM frontend crashes with assertion failure:
```
clang++: /root/llvm-project/clang/lib/AST/ExprConstant.cpp:10704: bool EvaluateTemporary(const clang::Expr*, {anonymous}::LValue&, {anonymous}::EvalInfo&): Assertion `E->isPRValue() && E->getType()->isRecordType()' failed.```
Removing `return` keyword and leaving `T{}.~T();` compiles successfully.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJx8VF2PqzYT_jWTm9EibAiQCy6STXj1qltptY1Or42ZEHeNjWyTTXrR314ZNjltz7YSSmzP9zPPjPBe9YaohvUO1vuVmMLZuvp4G5Qw9P76smptd6tfne2dGCDb4rUqnoocpRamR7ZJWJIi8Ep4Ty4oazzwDaR7SLeHqxhGTdEI1rtnO4xKk8PDddTWkYP1Hnh1DmH0kG2BN8Cb3nat1SGxrgfe_A68ef31Jy-K40k-3L7YPgb0YiC0UxingMp41RGGM-HzAbUy7yhae6Fos0Sf033Stk_CNXwZWYXz1CbSDsCbyZN7EiEIeR7IBA-8OSlN8Z-VxYatWQa8-bvPe3r_UxcycyrSdrH45RmKdPnkOC4vF6s6NHYEXsUj8A0aS1dJY_g0KXfLAREx3Ebq6ITKBDxC9heJozA5g8eoXu6TP47Aq7nw3d3N_hH8E8GXbz_jyVkTyHQonfBn8vihwhkfbcSTUHpyXxSwXOfige_iFyHmjbM2AG-0vgxPo7O_kQx3kOKzaoE321-OwJvDdXTP1vggTEgiHtmWpWWaR0ettRoPF6EnEehIw2idcDfglYwGC-1iTtk2egG-Bf6MUO6EseY22MnHcmf5yzehJwJe_KtGDPN_c7KzzsyU7aN8KNLDE2QH5V_fPh1FVHHWLXCW9RSOt_FTsii_kbSu-_4KvJyRpC75B4DL7xsN9qJMH-MtjYQixXe6fVjXoTAdahJ3ha9aXKQol8ny6CcpyfvTpPUtWXV11m2yjVhRzcqM8TwveLU617xYCyYz2rA05V1XnlhRMp5LkVKWcpmvVM1TnjPGUpaxMq2SNu_aPGdptSloXWQZ5CkNQukk9jrO6kp5P1HN2LpYVystWtJ-3iicG_rAWQqcxwXj6pkg7dR7yFOtfPDf3QQVNNUzNdwkg4rMecaOHtcZkQWn-YaRKIT2hMK1KkSqzJOCR5Ri8hGTIIKSP_L6vjPiLAAv_WMeVpPT9X_shpjsjzSfS5z3w4LBpeZ_BgAA__9ODKYa">