<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/62854>62854</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Access to constructor is checked when it is not called
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
Fedr
</td>
</tr>
</table>
<pre>
The following program allocates zero elements of `A`, so constructor shall not be called:
```
class A {
A();
};
int main() {
delete[] new A[0];
}
```
The program is accepted in GCC, but Clang complains:
```
error: calling a private constructor of class 'A'
delete[] new A[0];
```
Online demo: https://gcc.godbolt.org/z/sqG9b857d
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyUkkGOnDwQhU9TbErTchcNNAsWTLeY5b_5L2DsApwYm9hmRpnTR8BEk46SRSRkoKCq3vf0ZIxmdMwNFM9Q3DO5psmHpmMdst7r783_E-PgrfVvxo24BD8GOaO01iuZOOI7B49seWaXIvoBoRQtlALohtGj8i6msKrkA8ZJWovOJ-wZlbSWNeQtiDscHce1vyorY8QWoXo-CtgCXYFqyD8KUN0_n_fTuISzNO748ZdWRNRsOfHBiI7fsIXiWUBxf5j3JyUb_09qE1EqxUtijcbhy-22UfZrwpuVbkTl58VK4-LfsDgEHyBvd_rNT4lLMK8y8YNRfsDDAKCqBar-ieNx43H-56xxjJpnv22fUlp2jdQBdaNSp9Hr3tt08mEE6t6Buvjtpe6vRaUz3eS6zmuZcXMur5fqUp0veTY1VAol5FnRkFOpByrOirSk6ir7cigGykxDgnJREIn6XIv8dFWqzCtdDlpTpVnARfAsjT1Z-zpvuzMT48pNSdfiklnZs417MIk21v0jEG05Dc3W89SvY4SLsCam-DklmWS5aZXiGDE9htBEVBOrr6zxbWKHJm2lLZRHIrM12OY3g0ya1v6k_AzUbUs-bk9L8F9YJaBulxaBul36jwAAAP__Y53_Lg">