<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/121319>121319</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [clang] Dynamic initialization of an array of objects with a private destructor is rejected by clang
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            clang
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          Rush10233
      </td>
    </tr>
</table>

<pre>
    Very surprised to see that:

```c++
class S {
  ~S()=default;
};


int main(){
    S *ss = new S[100];
}
```

This is rejected by clang:

```c++
<source>:7:17: error: temporary of type 'S' has private destructor
    7 |     S *ss = new S[100];
      | ^
<source>:2:3: note: implicitly declared private here
    2 | ~S()=default;
      |   ^
```

I wonder if I have missed some instructions on the standard, but it appears that other compilers including GCC, MSVC and EDG can normally accept it.

https://godbolt.org/z/9d6Y5b3Mr
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJyMU02P4zYM_TX0hdjAlux4cvAhE08We9hLUyzQIy1xYhWyZEhyBt5Df3shJ-30Y1osQEQKTD6-Rz1SjObqmDtonqHpC1rS6EP30xLHqhRSFoPXa_eNw4pxCXMwkTUmj5EZ00gJ5BHKLfblPRSI5xzlUVmKES8Ibf6H-NsFxBOIA8he8ystNoHMX6DtH5ctjEs4kXGP5EcxZiBxjBFB9uj4DS_QPFdlCU3_DvMXHnewn0cT0UQM_CurxBqHFZUld_0_4iBP0S9BMcgXkMcW5LHKP8gh-JAviafZBwor-ldM68wIor2AaHGkiHMwN0qMmmMKi0o-PCS0CO0Jf0TMlrRlQ_Pyb0oC5FFmIs4nzqeZZmuUSXZFzcpSYP0njZEDPyDFBvlfD_HeFP9o-_dpfsE37zQHNK_4BUe6MU4mZktEPzEad9drvIvoHaaRMSZymoIGccJhSWgS0jwzhbj5B30aOaDy02wsh4jGKbto4674-XTKRV8v305ITuNL_xkVOXQ-TGTtiqQUzxlxd2c3pjTH_K7iDOJ89XrwNu18uII4fwdxPuj9L80gv4ZCd1If5IEK7qpWNk1dV7Usxu5pGPipYd4fBqqfhrLaS3VQbS2bVnIpRGE6UYq6ErIsW9nUcncoh5L0fs9Cv-4rQVCXPJGxO2tvU-5dmBgX7ipRyepQWBrYxm3ZhLj7UIi8d6HLBZ-G5RqhLq2JKb5DJJPstqH3iqbHfnU0GYXGmWTImu-Uh57NSA4pBNqM6Yds-ohvJo1IH9jyw80olmC7f8zSpHEZdspPIM6Z1uP4NAefq0GcN5kRxPmh9NaJ3wMAAP__9n1Ojw">