From Jason Turner

[language.support]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmp7ftnznb5/{from.md → to.md} +153 -62
tmp/tmp7ftnznb5/{from.md → to.md} RENAMED
@@ -870,14 +870,20 @@ namespace std {
870
 
871
  void* operator new(std::size_t size);
872
  void* operator new(std::size_t size, const std::nothrow_t&) noexcept;
873
  void operator delete(void* ptr) noexcept;
874
  void operator delete(void* ptr, const std::nothrow_t&) noexcept;
 
 
 
875
  void* operator new[](std::size_t size);
876
  void* operator new[](std::size_t size, const std::nothrow_t&) noexcept;
877
  void operator delete[](void* ptr) noexcept;
878
  void operator delete[](void* ptr, const std::nothrow_t&) noexcept;
 
 
 
879
 
880
  void* operator new (std::size_t size, void* ptr) noexcept;
881
  void* operator new[](std::size_t size, void* ptr) noexcept;
882
  void operator delete (void* ptr, void*) noexcept;
883
  void operator delete[](void* ptr, void*) noexcept;
@@ -948,24 +954,31 @@ is binding on a replacement version of this function.
948
  normally, returns the result of that call. Otherwise, returns a null
949
  pointer.
950
 
951
  ``` cpp
952
  T* p1 = new T; // throws bad_alloc if it fails
953
- T* p2 = new(nothrow) T; // returns 0 if it fails
954
  ```
955
 
956
  ``` cpp
957
  void operator delete(void* ptr) noexcept;
 
958
  ```
959
 
960
  *Effects:* The *deallocation
961
  function* ([[basic.stc.dynamic.deallocation]]) called by a
962
  *delete-expression* to render the value of `ptr` invalid.
963
 
964
- *Replaceable:* a C++program may define a function with this function
965
- signature that displaces the default version defined by the C++standard
966
- library.
 
 
 
 
 
 
967
 
968
  *Requires:* *ptr* shall be a null pointer or its value shall be a value
969
  returned by an earlier call to the (possibly replaced)
970
  `operator new(std::size_t)` or
971
  `operator new(std::size_t,const std::nothrow_t&)` which has not been
@@ -973,37 +986,75 @@ invalidated by an intervening call to `operator delete(void*)`.
973
 
974
  *Requires:* If an implementation has strict pointer
975
  safety ([[basic.stc.dynamic.safety]]) then `ptr` shall be a
976
  safely-derived pointer.
977
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
978
  *Default behavior:* If `ptr` is null, does nothing. Otherwise, reclaims
979
  the storage allocated by the earlier call to `operator new`.
980
 
981
  *Remarks:* It is unspecified under what conditions part or all of such
982
  reclaimed storage will be allocated by subsequent calls to
983
  `operator new` or any of `calloc`, `malloc`, or `realloc`, declared in
984
  `<cstdlib>`.
985
 
986
  ``` cpp
987
  void operator delete(void* ptr, const std::nothrow_t&) noexcept;
 
988
  ```
989
 
990
  *Effects:* The *deallocation
991
  function* ([[basic.stc.dynamic.deallocation]]) called by the
992
  implementation to render the value of `ptr` invalid when the constructor
993
  invoked from a nothrow placement version of the *new-expression* throws
994
  an exception.
995
 
996
- *Replaceable:* a C++program may define a function with this function
997
- signature that displaces the default version defined by the C++standard
998
- library.
 
 
 
 
 
 
 
999
 
1000
  *Requires:* If an implementation has strict pointer
1001
  safety ([[basic.stc.dynamic.safety]]) then `ptr` shall be a
1002
  safely-derived pointer.
1003
 
1004
- *Default behavior:* calls `operator delete(ptr)`.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1005
 
1006
  #### Array forms <a id="new.delete.array">[[new.delete.array]]</a>
1007
 
1008
  ``` cpp
1009
  void* operator new[](std::size_t size);
@@ -1043,50 +1094,92 @@ requirement is binding on a replacement version of this function.
1043
  normally, returns the result of that call. Otherwise, returns a null
1044
  pointer.
1045
 
1046
  ``` cpp
1047
  void operator delete[](void* ptr) noexcept;
 
1048
  ```
1049
 
1050
  *Effects:* The *deallocation
1051
  function* ([[basic.stc.dynamic.deallocation]]) called by the array form
1052
  of a *delete-expression* to render the value of `ptr` invalid.
1053
 
1054
- *Replaceable:* a C++program can define a function with this function
1055
- signature that displaces the default version defined by the C++standard
1056
- library.
 
 
 
 
 
 
1057
 
1058
  *Requires:* *ptr* shall be a null pointer or its value shall be the
1059
  value returned by an earlier call to `operator new[](std::size_t)` or
1060
  `operator new[](std::size_t,const std::nothrow_t&)` which has not been
1061
  invalidated by an intervening call to `operator delete[](void*)`.
1062
 
 
 
 
 
 
 
 
 
 
 
1063
  *Requires:* If an implementation has strict pointer
1064
  safety ([[basic.stc.dynamic.safety]]) then `ptr` shall be a
1065
  safely-derived pointer.
1066
 
1067
- *Default behavior:* Calls `operator delete(ptr)`.
 
 
1068
 
1069
  ``` cpp
1070
  void operator delete[](void* ptr, const std::nothrow_t&) noexcept;
 
1071
  ```
1072
 
1073
  *Effects:* The *deallocation
1074
  function* ([[basic.stc.dynamic.deallocation]]) called by the
1075
  implementation to render the value of `ptr` invalid when the constructor
1076
  invoked from a nothrow placement version of the array *new-expression*
1077
  throws an exception.
1078
 
1079
- *Replaceable:* a C++program may define a function with this function
1080
- signature that displaces the default version defined by the C++standard
1081
- library.
 
 
 
 
 
 
 
1082
 
1083
  *Requires:* If an implementation has strict pointer
1084
  safety ([[basic.stc.dynamic.safety]]) then `ptr` shall be a
1085
  safely-derived pointer.
1086
 
1087
- *Default behavior:* calls `operator delete[](ptr)`.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1088
 
1089
  #### Placement forms <a id="new.delete.placement">[[new.delete.placement]]</a>
1090
 
1091
  These functions are reserved, a C++program may not define functions that
1092
  displace the versions in the Standard C++library ([[constraints]]). The
@@ -1147,22 +1240,18 @@ operator new terminates by throwing an exception ([[expr.new]]).
1147
 
1148
  #### Data races <a id="new.delete.dataraces">[[new.delete.dataraces]]</a>
1149
 
1150
  For purposes of determining the existence of data races, the library
1151
  versions of `operator new`, user replacement versions of global
1152
- `operator new`, and the C standard library functions `calloc` and
1153
- `malloc` shall behave as though they accessed and modified only the
1154
- storage referenced by the return value. The library versions of
1155
- `operator delete`, user replacement versions of `operator delete`, and
1156
- the C standard library function `free` shall behave as though they
1157
- accessed and modified only the storage referenced by their first
1158
- argument. The C standard library function `realloc` shall behave as
1159
- though it accessed and modified only the storage referenced by its first
1160
- argument and by its return value. Calls to these functions that allocate
1161
- or deallocate a particular unit of storage shall occur in a single total
1162
- order, and each such deallocation call shall happen before the next
1163
- allocation (if any) in this order.
1164
 
1165
  ### Storage allocation errors <a id="alloc.errors">[[alloc.errors]]</a>
1166
 
1167
  #### Class `bad_alloc` <a id="bad.alloc">[[bad.alloc]]</a>
1168
 
@@ -1468,11 +1557,11 @@ namespace std {
1468
 
1469
  exception_ptr current_exception() noexcept;
1470
  [[noreturn]] void rethrow_exception(exception_ptr p);
1471
  template<class E> exception_ptr make_exception_ptr(E e) noexcept;
1472
 
1473
- [[noreturn]] template <class T> void throw_with_nested(T&& t);
1474
  template <class E> void rethrow_if_nested(const E& e);
1475
  }
1476
  ```
1477
 
1478
    [[except.special]].
@@ -1507,12 +1596,10 @@ of `rhs`, then `strcmp(lhs.what(), rhs.what())` shall equal 0.
1507
  exception() noexcept;
1508
  ```
1509
 
1510
  *Effects:* Constructs an object of class `exception`.
1511
 
1512
- *Remarks:* Does not throw any exceptions.
1513
-
1514
  ``` cpp
1515
  exception(const exception& rhs) noexcept;
1516
  exception& operator=(const exception& rhs) noexcept;
1517
  ```
1518
 
@@ -1525,12 +1612,10 @@ If `*this` and `rhs` both have dynamic type `exception` then
1525
  virtual ~exception();
1526
  ```
1527
 
1528
  *Effects:* Destroys an object of class `exception`.
1529
 
1530
- *Remarks:* Does not throw any exceptions.
1531
-
1532
  ``` cpp
1533
  virtual const char* what() const noexcept;
1534
  ```
1535
 
1536
  *Returns:* An *implementation-defined* NTBS.
@@ -1631,13 +1716,12 @@ value.
1631
  [[noreturn]] void terminate() noexcept;
1632
  ```
1633
 
1634
  *Remarks:* Called by the implementation when exception handling must be
1635
  abandoned for any of several reasons ([[except.terminate]]), in effect
1636
- immediately after evaluating the
1637
- *throw-expression* ([[terminate.handler]]). May also be called directly
1638
- by the program.
1639
 
1640
  *Effects:* Calls the current `terminate_handler` function. A default
1641
  `terminate_handler` is always considered a callable handler in this
1642
  context.
1643
 
@@ -1750,11 +1834,11 @@ namespace std {
1750
  // access functions
1751
  [[noreturn]] void rethrow_nested() const;
1752
  exception_ptr nested_ptr() const noexcept;
1753
  };
1754
 
1755
- [[noreturn]] template<class T> void throw_with_nested(T&& t);
1756
  template <class E> void rethrow_if_nested(const E& e);
1757
  }
1758
  ```
1759
 
1760
  The class `nested_exception` is designed for use as a mixin through
@@ -1785,14 +1869,14 @@ exception_ptr nested_ptr() const noexcept;
1785
 
1786
  *Returns:* The stored exception captured by this `nested_exception`
1787
  object.
1788
 
1789
  ``` cpp
1790
- [[noreturn]] template <class T> void throw_with_nested(T&& t);
1791
  ```
1792
 
1793
- Let `U` be `remove_reference<T>::type`.
1794
 
1795
  *Requires:* `U` shall be `CopyConstructible`.
1796
 
1797
  *Throws:* if `U` is a non-union class type not derived from
1798
  `nested_exception`, an exception of unspecified type that is publicly
@@ -1807,11 +1891,13 @@ template <class E> void rethrow_if_nested(const E& e);
1807
  derived from `nested_exception`, calls `dynamic_cast<const`
1808
  `nested_exception&>(e).rethrow_nested()`.
1809
 
1810
  ## Initializer lists <a id="support.initlist">[[support.initlist]]</a>
1811
 
1812
- The header `<initializer_list>` defines one type.
 
 
1813
 
1814
  ``` cpp
1815
  namespace std {
1816
  template<class E> class initializer_list {
1817
  public:
@@ -1821,20 +1907,20 @@ namespace std {
1821
  typedef size_t size_type;
1822
 
1823
  typedef const E* iterator;
1824
  typedef const E* const_iterator;
1825
 
1826
- initializer_list() noexcept;
1827
 
1828
- size_t size() const noexcept; // number of elements
1829
- const E* begin() const noexcept; // first element
1830
- const E* end() const noexcept; // one past the last element
1831
  };
1832
 
1833
  // [support.initlist.range] initializer list range access
1834
- template<class E> const E* begin(initializer_list<E> il) noexcept;
1835
- template<class E> const E* end(initializer_list<E> il) noexcept;
1836
  }
1837
  ```
1838
 
1839
  An object of type `initializer_list<E>` provides access to an array of
1840
  objects of type `const E`. A pair of pointers or a pointer plus a length
@@ -1844,51 +1930,51 @@ in  [[dcl.init.list]]. Copying an initializer list does not copy the
1844
  underlying elements.
1845
 
1846
  ### Initializer list constructors <a id="support.initlist.cons">[[support.initlist.cons]]</a>
1847
 
1848
  ``` cpp
1849
- initializer_list() noexcept;
1850
  ```
1851
 
1852
  *Effects:* constructs an empty `initializer_list` object.
1853
 
1854
  `size() == 0`
1855
 
1856
  ### Initializer list access <a id="support.initlist.access">[[support.initlist.access]]</a>
1857
 
1858
  ``` cpp
1859
- const E* begin() const noexcept;
1860
  ```
1861
 
1862
  *Returns:* A pointer to the beginning of the array. If `size() == 0` the
1863
  values of `begin()` and `end()` are unspecified but they shall be
1864
  identical.
1865
 
1866
  ``` cpp
1867
- const E* end() const noexcept;
1868
  ```
1869
 
1870
  *Returns:* `begin() + size()`
1871
 
1872
  ``` cpp
1873
- size_t size() const noexcept;
1874
  ```
1875
 
1876
  *Returns:* The number of elements in the array.
1877
 
1878
- *Complexity:* constant time.
1879
 
1880
  ### Initializer list range access <a id="support.initlist.range">[[support.initlist.range]]</a>
1881
 
1882
  ``` cpp
1883
- template<class E> const E* begin(initializer_list<E> il) noexcept;
1884
  ```
1885
 
1886
  *Returns:* `il.begin()`.
1887
 
1888
  ``` cpp
1889
- template<class E> const E* end(initializer_list<E> il) noexcept;
1890
  ```
1891
 
1892
  *Returns:* `il.end()`.
1893
 
1894
  ## Other runtime support <a id="support.runtime">[[support.runtime]]</a>
@@ -1907,13 +1993,13 @@ following changes:
1907
  The restrictions that ISO C places on the second parameter to the
1908
  `va_start()` macro in header `<stdarg.h>` are different in this
1909
  International Standard. The parameter `parmN` is the identifier of the
1910
  rightmost parameter in the variable parameter list of the function
1911
  definition (the one just before the `...`).[^34] If the parameter
1912
- `parmN` is declared with a function, array, or reference type, or with a
1913
- type that is not compatible with the type that results when passing an
1914
- argument for which there is no parameter, the behavior is undefined.
1915
 
1916
  ISO C 4.8.1.1.
1917
 
1918
  The function signature `longjmp(jmp_buf jbuf, int val)` has more
1919
  restricted behavior in this International Standard. A `setjmp`/`longjmp`
@@ -1938,21 +2024,26 @@ The header `<cstdalign>` and the header `<stdalign.h>` shall not define
1938
  a macro named `alignas`.
1939
 
1940
  The header `<cstdbool>` and the header `<stdbool.h>` shall not define
1941
  macros named `bool`, `true`, or `false`.
1942
 
 
 
 
1943
  The common subset of the C and C++languages consists of all
1944
  declarations, definitions, and expressions that may appear in a well
1945
  formed C++program and also in a conforming C program. A POF (“plain old
1946
  function”) is a function that uses only features from this common
1947
  subset, and that does not directly or indirectly use any function that
1948
- is not a POF, except that it may use functions defined in Clause 
1949
- [[atomics]] that are not member functions. All signal handlers shall
1950
- have C linkage. A POF that could be used as a signal handler in a
1951
- conforming C program does not produce undefined behavior when used as a
1952
- signal handler in a C++program. The behavior of any other function used
1953
- as a signal handler in a C++program is *implementation-defined*.[^35]
 
 
1954
 
1955
  <!-- Link reference definitions -->
1956
  [alloc.errors]: #alloc.errors
1957
  [atomics]: atomics.md#atomics
1958
  [bad.alloc]: #bad.alloc
 
870
 
871
  void* operator new(std::size_t size);
872
  void* operator new(std::size_t size, const std::nothrow_t&) noexcept;
873
  void operator delete(void* ptr) noexcept;
874
  void operator delete(void* ptr, const std::nothrow_t&) noexcept;
875
+ void operator delete(void* ptr, std::size_t size) noexcept;
876
+ void operator delete(void* ptr, std::size_t size,
877
+ const std::nothrow_t&) noexcept;
878
  void* operator new[](std::size_t size);
879
  void* operator new[](std::size_t size, const std::nothrow_t&) noexcept;
880
  void operator delete[](void* ptr) noexcept;
881
  void operator delete[](void* ptr, const std::nothrow_t&) noexcept;
882
+ void operator delete[](void* ptr, std::size_t size) noexcept;
883
+ void operator delete[](void* ptr, std::size_t size,
884
+ const std::nothrow_t&) noexcept;
885
 
886
  void* operator new (std::size_t size, void* ptr) noexcept;
887
  void* operator new[](std::size_t size, void* ptr) noexcept;
888
  void operator delete (void* ptr, void*) noexcept;
889
  void operator delete[](void* ptr, void*) noexcept;
 
954
  normally, returns the result of that call. Otherwise, returns a null
955
  pointer.
956
 
957
  ``` cpp
958
  T* p1 = new T; // throws bad_alloc if it fails
959
+ T* p2 = new(nothrow) T; // returns nullptr if it fails
960
  ```
961
 
962
  ``` cpp
963
  void operator delete(void* ptr) noexcept;
964
+ void operator delete(void* ptr, std::size_t size) noexcept;
965
  ```
966
 
967
  *Effects:* The *deallocation
968
  function* ([[basic.stc.dynamic.deallocation]]) called by a
969
  *delete-expression* to render the value of `ptr` invalid.
970
 
971
+ *Replaceable:* a C++program may define a function with signature
972
+ `void operator delete(void* ptr) noexcept` that displaces the default
973
+ version defined by the C++standard library. If this function (without
974
+ `size` parameter) is defined, the program should also define
975
+ `void operator delete(void* ptr, std::size_t size) noexcept`. If this
976
+ function with `size` parameter is defined, the program shall also define
977
+ the version without the `size` parameter. The default behavior below may
978
+ change in the future, which will require replacing both deallocation
979
+ functions when replacing the allocation function.
980
 
981
  *Requires:* *ptr* shall be a null pointer or its value shall be a value
982
  returned by an earlier call to the (possibly replaced)
983
  `operator new(std::size_t)` or
984
  `operator new(std::size_t,const std::nothrow_t&)` which has not been
 
986
 
987
  *Requires:* If an implementation has strict pointer
988
  safety ([[basic.stc.dynamic.safety]]) then `ptr` shall be a
989
  safely-derived pointer.
990
 
991
+ *Requires:* If present, the `std::size_t size` argument shall equal the
992
+ size argument passed to the allocation function that returned `ptr`.
993
+
994
+ *Required behavior:* Calls to
995
+ `operator delete(void* ptr, std::size_t size)` may be changed to calls
996
+ to `operator delete(void* ptr)` without affecting memory allocation. A
997
+ conforming implementation is for
998
+ `operator delete(void* ptr, std::size_t size)` to simply call
999
+ `operator delete(ptr)`.
1000
+
1001
+ *Default behavior:* the function
1002
+ `operator delete(void* ptr, std::size_t size)` calls
1003
+ `operator delete(ptr)`. See the note in the above *Replaceable*
1004
+ paragraph.
1005
+
1006
  *Default behavior:* If `ptr` is null, does nothing. Otherwise, reclaims
1007
  the storage allocated by the earlier call to `operator new`.
1008
 
1009
  *Remarks:* It is unspecified under what conditions part or all of such
1010
  reclaimed storage will be allocated by subsequent calls to
1011
  `operator new` or any of `calloc`, `malloc`, or `realloc`, declared in
1012
  `<cstdlib>`.
1013
 
1014
  ``` cpp
1015
  void operator delete(void* ptr, const std::nothrow_t&) noexcept;
1016
+ void operator delete(void* ptr, std::size_t size, const std::nothrow_t&) noexcept;
1017
  ```
1018
 
1019
  *Effects:* The *deallocation
1020
  function* ([[basic.stc.dynamic.deallocation]]) called by the
1021
  implementation to render the value of `ptr` invalid when the constructor
1022
  invoked from a nothrow placement version of the *new-expression* throws
1023
  an exception.
1024
 
1025
+ *Replaceable:* a C++program may define a function with signature
1026
+ `void operator delete(void* ptr, const std::nothrow_t&) noexcept` that
1027
+ displaces the default version defined by the C++standard library. If
1028
+ this function (without `size` parameter) is defined, the program should
1029
+ also define
1030
+ `void operator delete(void* ptr, std::size_t size, const std::nothrow_t&) noexcept`.
1031
+ If this function with `size` parameter is defined, the program shall
1032
+ also define the version without the `size` parameter. The default
1033
+ behavior below may change in the future, which will require replacing
1034
+ both deallocation functions when replacing the allocation function.
1035
 
1036
  *Requires:* If an implementation has strict pointer
1037
  safety ([[basic.stc.dynamic.safety]]) then `ptr` shall be a
1038
  safely-derived pointer.
1039
 
1040
+ *Requires:* If present, the `std::size_t size` argument must equal the
1041
+ size argument passed to the allocation function that returned `ptr`.
1042
+
1043
+ *Required behavior:* Calls to
1044
+ `operator delete(void* ptr, std::size_t size, const std::nothrow_t&)`
1045
+ may be changed to calls to
1046
+ `operator delete(void* ptr, const std::nothrow_t&)` without affecting
1047
+ memory allocation. A conforming implementation is for
1048
+ `operator delete(void* ptr, std::size_t size, const std::nothrow_t&)` to
1049
+ simply call `operator delete(void* ptr, const std::nothrow_t&)`.
1050
+
1051
+ *Default behavior:*
1052
+ `operator delete(void* ptr, std::size_t size, const std::nothrow_t&)`
1053
+ calls `operator delete(ptr, std::nothrow)`, and
1054
+ `operator delete(void* ptr, const std::nothrow_t&)` calls
1055
+ `operator delete(ptr)`.
1056
 
1057
  #### Array forms <a id="new.delete.array">[[new.delete.array]]</a>
1058
 
1059
  ``` cpp
1060
  void* operator new[](std::size_t size);
 
1094
  normally, returns the result of that call. Otherwise, returns a null
1095
  pointer.
1096
 
1097
  ``` cpp
1098
  void operator delete[](void* ptr) noexcept;
1099
+ void operator delete[](void* ptr, std::size_t size) noexcept;
1100
  ```
1101
 
1102
  *Effects:* The *deallocation
1103
  function* ([[basic.stc.dynamic.deallocation]]) called by the array form
1104
  of a *delete-expression* to render the value of `ptr` invalid.
1105
 
1106
+ *Replaceable:* a C++program can define a function with signature
1107
+ `void operator delete[](void* ptr) noexcept` that displaces the default
1108
+ version defined by the C++standard library. If this function (without
1109
+ `size` parameter) is defined, the program should also define
1110
+ `void operator delete[](void* ptr, std::size_t size) noexcept`. If this
1111
+ function with `size` parameter is defined, the program shall also define
1112
+ the version without the `size` parameter. The default behavior below may
1113
+ change in the future, which will require replacing both deallocation
1114
+ functions when replacing the allocation function.
1115
 
1116
  *Requires:* *ptr* shall be a null pointer or its value shall be the
1117
  value returned by an earlier call to `operator new[](std::size_t)` or
1118
  `operator new[](std::size_t,const std::nothrow_t&)` which has not been
1119
  invalidated by an intervening call to `operator delete[](void*)`.
1120
 
1121
+ *Requires:* If present, the `std::size_t size` argument must equal the
1122
+ size argument passed to the allocation function that returned `ptr`.
1123
+
1124
+ *Required behavior:* Calls to
1125
+ `operator delete[](void* ptr, std::size_t size)` may be changed to calls
1126
+ to `operator delete[](void* ptr)` without affecting memory allocation. A
1127
+ conforming implementation is for
1128
+ `operator delete[](void* ptr, std::size_t size)` to simply call
1129
+ `operator delete[](void* ptr)`.
1130
+
1131
  *Requires:* If an implementation has strict pointer
1132
  safety ([[basic.stc.dynamic.safety]]) then `ptr` shall be a
1133
  safely-derived pointer.
1134
 
1135
+ *Default behavior:* `operator delete[](void* ptr, std::size_t size)`
1136
+ calls `operator delete[](ptr)`, and `operator delete[](void* ptr)` calls
1137
+ `operator delete(ptr)`.
1138
 
1139
  ``` cpp
1140
  void operator delete[](void* ptr, const std::nothrow_t&) noexcept;
1141
+ void operator delete[](void* ptr, std::size_t size, const std::nothrow_t&) noexcept;
1142
  ```
1143
 
1144
  *Effects:* The *deallocation
1145
  function* ([[basic.stc.dynamic.deallocation]]) called by the
1146
  implementation to render the value of `ptr` invalid when the constructor
1147
  invoked from a nothrow placement version of the array *new-expression*
1148
  throws an exception.
1149
 
1150
+ *Replaceable:* a C++program may define a function with signature
1151
+ `void operator delete[](void* ptr, const std::nothrow_t&) noexcept` that
1152
+ displaces the default version defined by the C++standard library. If
1153
+ this function (without `size` parameter) is defined, the program should
1154
+ also define
1155
+ `void operator delete[](void* ptr, std::size_t size, const std::nothrow_t&) noexcept`.
1156
+ If this function with `size` parameter is defined, the program shall
1157
+ also define the version without the `size` parameter. The default
1158
+ behavior below may change in the future, which will require replacing
1159
+ both deallocation functions when replacing the allocation function.
1160
 
1161
  *Requires:* If an implementation has strict pointer
1162
  safety ([[basic.stc.dynamic.safety]]) then `ptr` shall be a
1163
  safely-derived pointer.
1164
 
1165
+ *Requires:* If present, the `std::size_t size` argument must equal the
1166
+ size argument passed to the allocation function that returned `ptr`.
1167
+
1168
+ *Required behavior:* Calls to
1169
+ `operator delete[](void* ptr, std::size_t size, const std::nothrow_t&)`
1170
+ may be changed to calls to
1171
+ `operator delete[](void* ptr, const std::nothrow_t&)` without affecting
1172
+ memory allocation. A conforming implementation is for
1173
+ `operator delete[](void* ptr, std::size_t size, const std::nothrow_t&)`
1174
+ to simply call `operator delete[](void* ptr, const std::nothrow_t&)`.
1175
+
1176
+ *Default behavior:*
1177
+ `operator delete[](void* ptr, std::size_t size, const std::nothrow_t&)`
1178
+ calls `operator delete[](ptr, std::nothrow)`, and
1179
+ `operator delete[](void* ptr, const std::nothrow_t&)` calls
1180
+ `operator delete[](ptr)`.
1181
 
1182
  #### Placement forms <a id="new.delete.placement">[[new.delete.placement]]</a>
1183
 
1184
  These functions are reserved, a C++program may not define functions that
1185
  displace the versions in the Standard C++library ([[constraints]]). The
 
1240
 
1241
  #### Data races <a id="new.delete.dataraces">[[new.delete.dataraces]]</a>
1242
 
1243
  For purposes of determining the existence of data races, the library
1244
  versions of `operator new`, user replacement versions of global
1245
+ `operator new`, the C standard library functions `calloc` and `malloc`,
1246
+ the library versions of `operator delete`, user replacement versions of
1247
+ `operator delete`, the C standard library function `free`, and the C
1248
+ standard library function `realloc` shall not introduce a data race (
1249
+ [[res.on.data.races]]). Calls to these functions that allocate or
1250
+ deallocate a particular unit of storage shall occur in a single total
1251
+ order, and each such deallocation call shall happen before (
1252
+ [[intro.multithread]]) the next allocation (if any) in this order.
 
 
 
 
1253
 
1254
  ### Storage allocation errors <a id="alloc.errors">[[alloc.errors]]</a>
1255
 
1256
  #### Class `bad_alloc` <a id="bad.alloc">[[bad.alloc]]</a>
1257
 
 
1557
 
1558
  exception_ptr current_exception() noexcept;
1559
  [[noreturn]] void rethrow_exception(exception_ptr p);
1560
  template<class E> exception_ptr make_exception_ptr(E e) noexcept;
1561
 
1562
+ template <class T> [[noreturn]] void throw_with_nested(T&& t);
1563
  template <class E> void rethrow_if_nested(const E& e);
1564
  }
1565
  ```
1566
 
1567
    [[except.special]].
 
1596
  exception() noexcept;
1597
  ```
1598
 
1599
  *Effects:* Constructs an object of class `exception`.
1600
 
 
 
1601
  ``` cpp
1602
  exception(const exception& rhs) noexcept;
1603
  exception& operator=(const exception& rhs) noexcept;
1604
  ```
1605
 
 
1612
  virtual ~exception();
1613
  ```
1614
 
1615
  *Effects:* Destroys an object of class `exception`.
1616
 
 
 
1617
  ``` cpp
1618
  virtual const char* what() const noexcept;
1619
  ```
1620
 
1621
  *Returns:* An *implementation-defined* NTBS.
 
1716
  [[noreturn]] void terminate() noexcept;
1717
  ```
1718
 
1719
  *Remarks:* Called by the implementation when exception handling must be
1720
  abandoned for any of several reasons ([[except.terminate]]), in effect
1721
+ immediately after throwing the exception. May also be called directly by
1722
+ the program.
 
1723
 
1724
  *Effects:* Calls the current `terminate_handler` function. A default
1725
  `terminate_handler` is always considered a callable handler in this
1726
  context.
1727
 
 
1834
  // access functions
1835
  [[noreturn]] void rethrow_nested() const;
1836
  exception_ptr nested_ptr() const noexcept;
1837
  };
1838
 
1839
+ template<class T> [[noreturn]] void throw_with_nested(T&& t);
1840
  template <class E> void rethrow_if_nested(const E& e);
1841
  }
1842
  ```
1843
 
1844
  The class `nested_exception` is designed for use as a mixin through
 
1869
 
1870
  *Returns:* The stored exception captured by this `nested_exception`
1871
  object.
1872
 
1873
  ``` cpp
1874
+ template <class T> [[noreturn]] void throw_with_nested(T&& t);
1875
  ```
1876
 
1877
+ Let `U` be `remove_reference_t<T>`.
1878
 
1879
  *Requires:* `U` shall be `CopyConstructible`.
1880
 
1881
  *Throws:* if `U` is a non-union class type not derived from
1882
  `nested_exception`, an exception of unspecified type that is publicly
 
1891
  derived from `nested_exception`, calls `dynamic_cast<const`
1892
  `nested_exception&>(e).rethrow_nested()`.
1893
 
1894
  ## Initializer lists <a id="support.initlist">[[support.initlist]]</a>
1895
 
1896
+ The header `<initializer_list>` defines a class template and several
1897
+ support functions related to list-initialization (see
1898
+ [[dcl.init.list]]).
1899
 
1900
  ``` cpp
1901
  namespace std {
1902
  template<class E> class initializer_list {
1903
  public:
 
1907
  typedef size_t size_type;
1908
 
1909
  typedef const E* iterator;
1910
  typedef const E* const_iterator;
1911
 
1912
+ constexpr initializer_list() noexcept;
1913
 
1914
+ constexpr size_t size() const noexcept; // number of elements
1915
+ constexpr const E* begin() const noexcept; // first element
1916
+ constexpr const E* end() const noexcept; // one past the last element
1917
  };
1918
 
1919
  // [support.initlist.range] initializer list range access
1920
+ template<class E> constexpr const E* begin(initializer_list<E> il) noexcept;
1921
+ template<class E> constexpr const E* end(initializer_list<E> il) noexcept;
1922
  }
1923
  ```
1924
 
1925
  An object of type `initializer_list<E>` provides access to an array of
1926
  objects of type `const E`. A pair of pointers or a pointer plus a length
 
1930
  underlying elements.
1931
 
1932
  ### Initializer list constructors <a id="support.initlist.cons">[[support.initlist.cons]]</a>
1933
 
1934
  ``` cpp
1935
+ constexpr initializer_list() noexcept;
1936
  ```
1937
 
1938
  *Effects:* constructs an empty `initializer_list` object.
1939
 
1940
  `size() == 0`
1941
 
1942
  ### Initializer list access <a id="support.initlist.access">[[support.initlist.access]]</a>
1943
 
1944
  ``` cpp
1945
+ constexpr const E* begin() const noexcept;
1946
  ```
1947
 
1948
  *Returns:* A pointer to the beginning of the array. If `size() == 0` the
1949
  values of `begin()` and `end()` are unspecified but they shall be
1950
  identical.
1951
 
1952
  ``` cpp
1953
+ constexpr const E* end() const noexcept;
1954
  ```
1955
 
1956
  *Returns:* `begin() + size()`
1957
 
1958
  ``` cpp
1959
+ constexpr size_t size() const noexcept;
1960
  ```
1961
 
1962
  *Returns:* The number of elements in the array.
1963
 
1964
+ *Complexity:* Constant time.
1965
 
1966
  ### Initializer list range access <a id="support.initlist.range">[[support.initlist.range]]</a>
1967
 
1968
  ``` cpp
1969
+ template<class E> constexpr const E* begin(initializer_list<E> il) noexcept;
1970
  ```
1971
 
1972
  *Returns:* `il.begin()`.
1973
 
1974
  ``` cpp
1975
+ template<class E> constexpr const E* end(initializer_list<E> il) noexcept;
1976
  ```
1977
 
1978
  *Returns:* `il.end()`.
1979
 
1980
  ## Other runtime support <a id="support.runtime">[[support.runtime]]</a>
 
1993
  The restrictions that ISO C places on the second parameter to the
1994
  `va_start()` macro in header `<stdarg.h>` are different in this
1995
  International Standard. The parameter `parmN` is the identifier of the
1996
  rightmost parameter in the variable parameter list of the function
1997
  definition (the one just before the `...`).[^34] If the parameter
1998
+ `parmN` is of a reference type, or of a type that is not compatible with
1999
+ the type that results when passing an argument for which there is no
2000
+ parameter, the behavior is undefined.
2001
 
2002
  ISO C 4.8.1.1.
2003
 
2004
  The function signature `longjmp(jmp_buf jbuf, int val)` has more
2005
  restricted behavior in this International Standard. A `setjmp`/`longjmp`
 
2024
  a macro named `alignas`.
2025
 
2026
  The header `<cstdbool>` and the header `<stdbool.h>` shall not define
2027
  macros named `bool`, `true`, or `false`.
2028
 
2029
+ A call to the function `signal` synchronizes with any resulting
2030
+ invocation of the signal handler so installed.
2031
+
2032
  The common subset of the C and C++languages consists of all
2033
  declarations, definitions, and expressions that may appear in a well
2034
  formed C++program and also in a conforming C program. A POF (“plain old
2035
  function”) is a function that uses only features from this common
2036
  subset, and that does not directly or indirectly use any function that
2037
+ is not a POF, except that it may use plain lock-free atomic operations.
2038
+ A *plain lock-free atomic operation* is an invocation of a function *f*
2039
+ from Clause  [[atomics]], such that *f* is not a member function, and
2040
+ either *f* is the function `atomic_is_lock_free`, or for every atomic
2041
+ argument `A` passed to *f*, `atomic_is_lock_free(A)` yields `true`. All
2042
+ signal handlers shall have C linkage. The behavior of any function other
2043
+ than a POF used as a signal handler in a C++program is
2044
+ *implementation-defined*.[^35]
2045
 
2046
  <!-- Link reference definitions -->
2047
  [alloc.errors]: #alloc.errors
2048
  [atomics]: atomics.md#atomics
2049
  [bad.alloc]: #bad.alloc