<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/115815>115815</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Clang fails to detect dependent parameters in function scoped classes
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
ojhunt
</td>
</tr>
</table>
<pre>
Was writing test cases and found that clang fails to diagnose destroying operator delete with dependent parameters in function scoped class definitions:
```cpp
template <typename T> void test_func() {
struct __attribute__((aligned(128))) MyTerribleThing {
MyTerribleThing(){};
void *operator new(size_t, T) throw() {return 0;}
void operator delete(void *, T){}
void operator delete(MyTerribleThing *, std::destroying_delete_t, T){}
};
auto *obj = new MyTerribleThing;
delete obj;
}
int main() {
test_func<std::align_val_t>();
return 0;
}
```
gcc rejects, clang accepts. Both incorrectly (by my reading of the spec) accept this with the destroying delete removed, and emit an aligned delete.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyUVE2PqzgQ_DXm0noR2MmEHDjMJC-3vY20R2TsBjwyNrKbjLK_fmUgH5s5rJ6EjGS7q7qq3S1jNJ1DrNjug-1OmZyo96HyX_3kKGu8vlZ_ywjfwZBxHRBGAiUjRpBOQ-snp4F6SaCsdB200tgI5EEb2TkfETRGCv6agv2IQZIPoNEiIXwb6kHjiE6jIxhlkAMShgjGQTs5RcY7iMqPqBN-jKCxNc6k_cjEO8tPLL-tb_nyqXFcdgiH0UpCYOJI1xGdHBA-mfgNF2_0LKVOLIyXjB-A7T-WOIgUJkVQ15IomGYirOv5UiltMkszXhZz0PLBX9dPDME0Fj_7JPQB9XKyUKXj_YmJ2yWAJSPG3-8WOfxmvIzmH6yJ8SN8Jh7qg_9-pBuQpuAgT0j70wvYi9mMlzeOG9yaxv-F_RC3IETSqQLi_VHgeol5JPzK8B_VciI_S26-gIlTUvzDrmeL1kfjm6_79h18WY0jGKRxPwr6KLU43vOea1lfpK2Jid9rZe6Ez96-cN0e2jN1pxQE_EJFMYlfmkEqhSPFDXx46sE45UNARfYKjJfNFYYrBJR6bo0WqEeII6qU-hIJ1Ju4dEk6fOqk1YuAg7-k53icuxEHQyAdrK90vbXJdCX0QRxkhlWxF4Uo33Z7kfVVsX9DLnkreFMix5aXXGueF-KwU6oUTWYqnvNtURQ83275Tmz4gefyba-ELvOilZJtcxyksRtrL8PGhy4zMU5YFcWuLHaZlQ3aOI8WzmdPGOdpyoQqBfxqpi6ybW5NpPiAIEMWq-PLPEFCRX82LTBmU7BVTzTO04KfGT93hvqp2Sg_MH5OnOvv1xh8qh_j51lDZPy8yrhU_N8AAAD__3nuntY">