https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106269
--- Comment #2 from marshal ---
(In reply to marshal from comment #0)
> #include
> #include
>
> void operator delete[]( void* ptr ) noexcept {
> std::cout << "delete with 1 parameters==" << std::endl;
> ::operator delete(ptr);
> }
>
> void operator delete[]( void* ptr, std::size_t size ) noexcept {
>
> std::cout << "delete with 2 parameters==" << std::endl;
> ::operator delete(ptr);
> }
>
> int main()
> {
> int* p = new int[2];
> p[0] = 1;
> p[1] = 2;
> delete[] p;
> }
>
>
> The result is:
> delete with 1 parameters==
>
>
> But it does not follow c++14 spec as follow:
>
> C++14 Standard (ISO/IEC 14882:2014), Section 5.3.5, Paragraph 10:
> "If the type is complete and if deallocation function lookup finds both a
> usual deallocation function with only a pointer parameter and a usual
> deallocation function with both a pointer parameter and a size parameter,
> then the selected deallocation function shall be the one with two
> parameters. Otherwise, the selected deallocation function shall be the
> function with one parameter."
/*
* (c) Copyright 2017-2021 by Solid Sands B.V.,
* Amsterdam, the Netherlands. All rights reserved.
* Subject to conditions in the RESTRICTIONS file.
*/