Title
Possible problem in §[new.delete.single]
Status
new
Section
[new.delete.single]
Submitter
William M. Miller

Created on 2018-03-16.00:00:00, last changed 2018-06-19.05:49:11.

Messages

Date: 2018-06-19.05:49:11

Proposed resolution:

This wording is relative to N4727.

  1. Edit [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 [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]

Date: 2018-06-18.00:00:00

[ 2018-06-18 after reflector discussion ]

Priority set to 3

Date: 2018-04-15.00:00:00

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

Date: 2018-03-16.00:00:00

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, [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?

History
Date User Action Args
2018-06-19 05:49:11adminsetmessages: + msg9898
2018-04-03 19:17:52adminsetmessages: + msg9769
2018-04-03 19:17:52adminsetmessages: + msg9768
2018-03-16 00:00:00admincreate