This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of New status.

### 3086. Possible problem in §[new.delete.single]

Section: 17.7.3.2 [new.delete.single] Status: New Submitter: William M. Miller Opened: 2018-03-16 Last modified: 2020-09-06

Priority: 3

View other active issues in [new.delete.single].

View all other issues in [new.delete.single].

View all issues with New status.

Discussion:

In general requirements on a whole program, as opposed to a single translation unit, generally specify "no diagnostic required", since we don't want to require implementations to do multi-translation-unit analysis. However, 17.7.3.2 [new.delete.single] paragraph 11 says,

> If a function with a `size` parameter is defined, the program shall also define the corresponding version without the `size` parameter.

This is clearly not restricted to a single translation unit; should "no diagnostic required" be added?

[2018-04-03; Thomas Köppe and Tim Song suggest wording]

[2018-06-18 after reflector discussion]

Priority set to 3

Proposed resolution:

This wording is relative to N4727.

1. Edit 17.7.3.2 [new.delete.single] as indicated:

   >     void operator delete(void* ptr) noexcept;
   >     void operator delete(void* ptr, std::size_t size) noexcept;
   >     void operator delete(void* ptr, std::align_val_t alignment) noexcept;
   >     void operator delete(void* ptr, std::size_t size, std::align_val_t alignment) noexcept;

   > > -10- Effects: […]

   > > -11- Replaceable: A C++ program may define functions with any of these function signatures, and thereby displace the default versions defined by the C++ standard library. 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; no diagnostic is required. [Note: The default behavior below may change in the future, which will require replacing both deallocation functions when replacing the allocation function. — end note]

2. Edit 17.7.3.3 [new.delete.array] as indicated:

   >     void operator delete[](void* ptr) noexcept;
   >     void operator delete[](void* ptr, std::size_t size) noexcept;
   >     void operator delete[](void* ptr, std::align_val_t alignment) noexcept;
   >     void operator delete[](void* ptr, std::size_t size, std::align_val_t alignment) noexcept;

   > > -9- Effects: […]

   > > -10- Replaceable: A C++ program may define functions with any of these function signatures, and thereby displace the default versions defined by the C++ standard library. 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; no diagnostic is required. [Note: The default behavior below may change in the future, which will require replacing both deallocation functions when replacing the allocation function. — end note]