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

    <tr>
        <th>Summary</th>
        <td>
            [Diagnostics] Clang should issue a diagnostic when only one global operator delete is defined
        </td>
    </tr>

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

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

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

<pre>
    The C++ standard (in section 17.6.3.2, paragraph 13 in the latest working draft) mandates about **operator delete()** that "if a function without a size parameter is defined, the program should also define the corresponding function with a size parameter. If a function with a size parameter is defined, the program shall also define the corresponding version without the size parameter".
Clang does not seem to issue a diagnostic if this is violated. Perhaps it should.
Example code:

```
int *p;
void operator delete(void* ptr) noexcept {
  (void) ptr;
  p = 0;
}

//  void operator delete( void* ptr, std::size_t size ) noexcept {
//      p = 0;
//  }

int s;
int main()
{
  p = new int;
  delete p;
}
```

</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyUlM2OuzYQwJ_GXEZ_BEMgcOCQTRqptx56rxw8gFtjI3tIdvv0lQlNN5utqiIE8sx45jcftgxBD5aoFeWbKE-JXHh0vr0503_kTZUnF6c-2l9HgqPAN4FvEFhaJb0CgbW2EKhj7Szk-7RKixQFHmGWXg5eziPkBWgLPBIYyRQYbs7_oe0AysueBTYwRW9MAeTFLQwCDwIPbiYv2XlQZIhJYC2wuauARxnNUPcgoV_sPfxN8xj3Swj6T1oJJmLyoAMo6rUlFckiyezd4OUEYXSLUSBNcJvJqu6c9xRmZ1XkfArw4j2Fn18o_h-CNOY_CK7kw-cMo8VzAIGYiuwkssPRyFhbRwGsYwhEE7ADHcJCIEFpOVgXWHege-BRh8h21S42R6XwC_lRzgE0b8XZ3P70LqfZRDBFojjchdu3yrZ3XWq7tnAWxdtdcHVawWs7ozg2c2Yfh8A6eu9oZhD7bR_Aw6pZrYqHYgZRnCB7SMT-9ESEZ4FngH-JDE-hjxBYxZSKQ6zpb3wv7fdMf3uOzwvEpvsCE-sRHkZxNUltt3ne6L8kZukG2vKnhO_sMH-T8XP1E9UWqikamVCb7_OyqZusKZOxpZ6qfV-V1NVl0_R1WRRd1xe7Xd7kXb_fJbrFDHdZme-xKOq8TBHLvuqwrOtd1WeZFLuMJqlNasx1Sp0fknWo2gYrzBIjL2TCeocgdnEIBWK8Tnwb7X9cliGIXWZ04PCPB9Zs1ovn9JjLIMoT3Kd4O57fzO5tJAvOmg9wlmAw7iLN105_OnTJ4k07Ms8hNnrt06B5XC5p5yaB58iz_X7M3v1OHQs8r3GDwPOa4V8BAAD__zu5nfs">