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

    <tr>
        <th>Summary</th>
        <td>
            No matching function for call to 'operator delete[]'
        </td>
    </tr>

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

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

    <tr>
      <th>Reporter</th>
      <td>
          4kangjc
      </td>
    </tr>
</table>

<pre>
    ```cpp
// main.cpp
#include <new>

int main() {
  void* p = ::operator new[](2);
  ::operator delete[](p, 2);
}

```

```bash
# no problem
g++ main.cpp -std=c++20
# no problem
clang++ main.cpp -std=c++20 -stdlib=libc++
clang++ main.cpp -std=c++20 
main.cpp:5:3: error: no matching function for call to 'operator delete[]'
  ::operator delete[](p, 2);
 ^~~~~~~~~~~~~~~~~~~
/usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/12.2.0/../../../../include/c++/12.2.0/new:146:6: note: candidate function not viable: no known conversion from 'int' to 'const std::nothrow_t' for 2nd argument
void operator delete[](void*, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT
 ^
/usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/12.2.0/../../../../include/c++/12.2.0/new:161:6: note: candidate function not viable: no known conversion from 'int' to 'std::align_val_t' for 2nd argument
void operator delete[](void*, std::align_val_t)
 ^
/usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/12.2.0/../../../../include/c++/12.2.0/new:181:13: note: candidate function not viable: no known conversion from 'int' to 'void *' for 2nd argument
inline void operator delete[](void*, void*) _GLIBCXX_USE_NOEXCEPT { }
 ^
/usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/12.2.0/../../../../include/c++/12.2.0/new:132:6: note: candidate function not viable: requires 1 argument, but 2 were provided
void operator delete[](void*) _GLIBCXX_USE_NOEXCEPT
 ^
/usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/12.2.0/../../../../include/c++/12.2.0/new:163:6: note: candidate function not viable: requires 3 arguments, but 2 were provided
void operator delete[](void*, std::align_val_t, const std::nothrow_t&)
     ^
1 error generated
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzMll2vozYTxz_N5GYUBHZ4u-CCvPDokaptpbbSuYsMTIh3HZsak7O96WevTBJyut1oe7a76okiQJP5k-Hn_zAWwyA7TVRAvIZ4uxCjOxpbrD4I3b1vFrVpfy8gCS_fpu8h3EJYAquAVXgSUgcvglzqRo0tIfCNpmfgu-sv01FqNymAZcByhHR9iSOejWyBldgj8C0CL4GXpicrnLHobzTVBixjwHLgs-6TzJYUOZqTe2Ab_IsC0u3Lgubn-mywFsNxfjDUBntrakWnS6wDtga2nhHgcnAt8G1zibPwsbRRQn9RPgWUrIFvlayv4dfoL7nzCvEyBl5y4CWStcb6C23wJFxzlLrDw6gbJ43Gg7HYCKXQGQSWPoCbfu0SIMS7P_72mV01DhZYVXuTVEEArFKyTlbAqq5pgFUfs2SfrJZ9s1RSjx-XnR6BVRELWBDeFJ8crpYEVt0gvhBMJi2jVQK8TC5IHPlzI3QrW-HoDkYbh2cpakVXdh-0edbYGH0mO0zorDl5ZlI7YOkVYGP04HBaHU9KG3e05nk_ZXjWTLcobDeeSLsLBt8N-IjotVU818d3Tnx_7f_3w__Xm6en_a8_7_bvftw9bXY__XJfhP8YeRJ9P-QzEqFkp_dnob4F7s_fNX8zRDNPNOLfB-kEaQLxCKPUSmrCf0pzvnxgVD8ecH5fvwG8nL3asJZ-G6WlAaM7K7bBenTI8Jks-blwli21r3Him-9s_vWg-Axq-AakHvXsl16dt9mGeMcZXcYmdqT9v94KmXcLi7bgbc5zsaAiSlIepWEWpotjIRJxoFxQ3oYUURvXIaV5nedxnlEaiXwhCxYyHkZhFuarMEyDiNghZjylNErFIYthFdJJSBUodT4FxnYLOQwjFXGeZWyhRE1quG3fbOGTlvXYDbAKlRzccJc56RQV7_7F1F-MVhVH5_rBg5s2gZ10x7EOGnPyBlPn22nZW_OeGudd48sdgFVTxX8GAAD__w9DEIk">