Document numberP2045R0
Date2020-01-10
ProjectProgramming Language C++, Library Working Group
Reply-toMarshall Clow <mclow.lists@gmail.com>

Missing Mandates for the standard library

Introduction

As the "Mandating the standard library" papers have progressed/been applied, a few bits have been missed; mostly because parts of the library have moved.

This paper fixes those bits.

Thanks to Richard Smith for enumerating these parts.

Wording

These changes are based on N4842.

In [tab:cpp17.allocator], change the "Requires" to an "Preconditions":

Preconditions:Requires: (*p).m is well-defined.

Preconditions:Requires: (*q).m is well-defined.

Preconditions:Requires: p isshall be a value returned by an earlier call to allocate that has not been invalidated by an intervening call to deallocate. n matchesshall match the value passed to allocate to obtain this memory.

   

In [res.on.required]/1 add:

Violation of any preconditions specified in a function’s Preconditions: or Requires: element results in undefined behavior

   

In [coroutine.handle.con]/2, change the "Requires" to an "Preconditions":

Preconditions:Requires: p is a reference to a promise object of a coroutine.

   

In [coroutine.handle.export.import]/2, change the "Requires" to an "Preconditions":

Preconditions:Requires: addr was obtained via a prior call to address

   

In [coroutine.handle.observers]/2 and /4, change the "Requires" to an "Preconditions":

Preconditions:Requires: *this refers to a suspended coroutine

Preconditions:Requires: *this refers to a suspended coroutine

   

In [coroutine.handle.promise]/1, change the "Requires" to an "Preconditions":

Preconditions:Requires: *this refers to a coroutine.

   

In [util.smartptr.atomic.shared]/3, /6, and /12, change the "Requires" to an "Preconditions":

Preconditions:Requires: order is neither The order argument shall not be memory_order::consume, memory_order::acquire, nor memory_order::acq_rel.

Preconditions:Requires: order is neithershall not be memory_order::release nor memory_order::acq_rel.

Preconditions:Requires: failure is neithershall not be memory_order::release nor memory_order::acq_rel.

   

In [util.smartptr.atomic.weak]/6 and /12, change the "Requires" to an "Preconditions":

Preconditions:Requires: order is neithershall not be memory_order::release nor memory_order::acq_rel

Preconditions:Requires: failure is neithershall not be memory_order::release nor memory_order::acq_rel