Skip to content

Commit d60ec60

Browse files
AlisdairMzygoloid
authored andcommitted
P0619R4 Review of deprecated facilities
1 parent 73409aa commit d60ec60

File tree

10 files changed

+196
-1001
lines changed

10 files changed

+196
-1001
lines changed

source/compatibility.tex

Lines changed: 110 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1085,13 +1085,9 @@
10851085
and
10861086
\tcode{<unordered_set>}.
10871087
In addition the following C compatibility headers are new:
1088-
\tcode{<ccomplex>},
10891088
\tcode{<cfenv>},
10901089
\tcode{<cinttypes>},
1091-
\tcode{<cstdalign>},
1092-
\tcode{<cstdbool>},
10931090
\tcode{<cstdint>},
1094-
\tcode{<ctgmath>},
10951091
and
10961092
\tcode{<cuchar>}.
10971093
Valid \CppIII{} code that \tcode{\#include}{s} headers with these names may be
@@ -1186,7 +1182,7 @@
11861182
have different runtime behavior.
11871183

11881184
\diffref{refwrap}, \ref{arithmetic.operations}, \ref{comparisons},
1189-
\ref{logical.operations}, \ref{bitwise.operations}, \ref{depr.negators}
1185+
\ref{logical.operations}, \ref{bitwise.operations}
11901186
\change Standard function object types no longer derived from
11911187
\tcode{std::unary_function} or \tcode{std::binary_function}.
11921188
\rationale Superseded by new feature; \tcode{unary_function} and
@@ -1987,6 +1983,20 @@
19871983
}
19881984
\end{codeblock}
19891985

1986+
\rSec2[diff.cpp17.except]{\ref{except}: exception handling}
1987+
1988+
\diffref{except.spec}
1989+
\change Remove \tcode{throw()} exception specification.
1990+
\rationale
1991+
The empty dynamic exception specification was retained for one additional \Cpp{}
1992+
Standard to ease the transition away from this feature.
1993+
\effect
1994+
A valid \CppXVII{} function declaration, member function declaration, function
1995+
pointer declaration, or function reference declaration that uses \tcode{throw()}
1996+
for its exception specification will be rejected as ill-formed in this
1997+
International Standard. It should simply be replaced with \tcode{noexcept} for no
1998+
change of meaning since \CppXVII{}.
1999+
19902000
\rSec2[diff.cpp17.library]{\ref{library}: library introduction}
19912001

19922002
\diffref{headers}
@@ -2001,6 +2011,19 @@
20012011
Valid \CppXVII{} code that \tcode{\#include}{s} headers with these names may be
20022012
invalid in this International Standard.
20032013

2014+
\diffref{headers}
2015+
\change Remove vacuous \Cpp{} header files.
2016+
\rationale
2017+
The empty headers implied a false requirement to achieve C compatibility with the \Cpp{} headers.
2018+
\effect
2019+
A valid \CppXVII{} program that \tcode{\#include}{s} any of the following headers may fail to compile:
2020+
\tcode{<ccomplex>},
2021+
\tcode{<ciso646>},
2022+
\tcode{<cstdalign>},
2023+
\tcode{<cstdbool>}, and
2024+
\tcode{<ctgmath>}.
2025+
The \tcode{\#include} directives can simply be removed with no loss of meaning.
2026+
20042027
\rSec2[diff.cpp17.containers]{\ref{containers}: containers library}
20052028

20062029
\diffrefs{forwardlist}{list}
@@ -2013,6 +2036,83 @@
20132036
Translation units compiled against this version of \Cpp{} may be incompatible with
20142037
translation units compiled against \CppXVII{}, either failing to link or having undefined behavior.
20152038

2039+
\rSec2[diff.cpp17.depr]{\ref{depr}: compatibility features}
2040+
2041+
\change Remove \tcode{uncaught_exception}.
2042+
\rationale
2043+
The function did not have a clear specification when multiple exceptions were
2044+
active, and has been superseded by \tcode{uncaught_exceptions}.
2045+
\effect
2046+
A valid \CppXVII{} program that calls \tcode{std::uncaught_exception} may fail
2047+
to compile. It might be revised to use \tcode{std::uncaught_exceptions} instead,
2048+
for clear and portable semantics.
2049+
2050+
\change Remove support for adaptable function API.
2051+
\rationale
2052+
The deprecated support relied on a limited convention that could not be
2053+
extended to support the general case or new language features. It has been
2054+
superseded by direct language support with \tcode{decltype}, and by the
2055+
\tcode{std::bind} and \tcode{std::not_fn} function templates.
2056+
\effect
2057+
A valid \CppXVII{} program that relies on the presence of \tcode{result_type},
2058+
\tcode{argument_type}, \tcode{first_argument_type}, or
2059+
\tcode{second_argument_type} in a standard library class may fail to compile. A
2060+
valid \CppXVII{} program that calls \tcode{not1} or \tcode{not2}, or uses the
2061+
class templates \tcode{unary_negate} or \tcode{binary_negate}, may fail to
2062+
compile.
2063+
2064+
\change Remove redundant members from \tcode{std::allocator}.
2065+
\rationale
2066+
\tcode{std::allocator} was overspecified, encouraging direct usage in user containers
2067+
rather than relying on \tcode{std::allocator_traits}, leading to poor containers.
2068+
\effect
2069+
A valid \CppXVII{} program that directly makes use of the \tcode{pointer},
2070+
\tcode{const_pointer}, \tcode{reference}, \tcode{const_reference},
2071+
\tcode{rebind}, \tcode{address}, \tcode{construct}, \tcode{destroy}, or
2072+
\tcode{max_size} members of \tcode{std::allocator}, or that directly calls
2073+
\tcode{allocate} with an additional hint argument, may fail to compile.
2074+
2075+
\change Remove \tcode{raw_memory_iterator}.
2076+
\rationale
2077+
The iterator encouraged use of algorithms that might throw exceptions, but did
2078+
not return the number of elements successfully constructed that might need to
2079+
be destroyed in order to avoid leaks.
2080+
\effect
2081+
A valid \CppXVII{} program that uses this iterator class may fail to compile.
2082+
2083+
\change Remove temporary buffers API.
2084+
\rationale
2085+
The temporary buffer facility was intended to provide an efficient optimization
2086+
for small memory requests, but there is little evidence this was achieved in
2087+
practice, while requiring the user to provide their own exception-safe wrappers
2088+
to guard use of the facility in many cases.
2089+
\effect
2090+
A valid \CppXVII{} program that calls \tcode{get_temporary_buffer} or
2091+
\tcode{return_temporary_buffer} may fail to compile.
2092+
2093+
\change Remove \tcode{shared_ptr::unique}.
2094+
\rationale
2095+
The result of a call to this member function is not reliable in the presence of
2096+
multiple threads and weak pointers. The member function \tcode{use_count} is
2097+
similarly unreliable, but has a clearer contract in such cases, and remains
2098+
available for well defined use in single-threaded cases.
2099+
\effect
2100+
A valid \CppXVII{} program that calls \tcode{unique} on a \tcode{shared_ptr}
2101+
object may fail to compile.
2102+
2103+
\diffref{depr.meta.types}
2104+
\change Remove deprecated type traits.
2105+
\rationale
2106+
The traits had unreliable or awkward interfaces. The \tcode{is_literal_type}
2107+
trait provided no way to detect which subset of constructors and member
2108+
functions of a type were declared \tcode{constexpr}. The \tcode{result_of}
2109+
trait had a surprising syntax that could not report the result of a regular
2110+
function type. It has been superseded by the \tcode{invoke_result} trait.
2111+
\effect
2112+
A valid \CppXVII{} program that relies on the \tcode{is_literal_type} or
2113+
\tcode{result_of} type traits, on the \tcode{is_literal_type_v} variable template,
2114+
or on the \tcode{result_of_t} alias template may fail to compile.
2115+
20162116
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
20172117
\rSec1[diff.library]{C standard library}
20182118
\indextext{library!C standard}%
@@ -2038,20 +2138,10 @@
20382138
nor are the C headers themselves part of \Cpp{}.
20392139

20402140
\pnum
2041-
The \Cpp{} headers \tcode{<ccomplex>}\indexhdr{ccomplex}\iref{depr.ccomplex.syn}
2042-
and \tcode{<ctgmath>}\indexhdr{ctgmath}\iref{depr.ctgmath.syn}, as well
2043-
as their corresponding C headers \tcode{<complex.h>}\indexhdr{complex.h}
2044-
and \tcode{<tgmath.h>}\indexhdr{tgmath.h}, do not contain any of the
2045-
content from the C standard library and instead merely include other headers
2046-
from the \Cpp{} standard library.
2047-
2048-
\pnum
2049-
The headers \tcode{<ciso646>}\indexhdr{ciso646},
2050-
\tcode{<cstdalign>}\indexhdr{cstdalign}\iref{depr.cstdalign.syn},
2051-
and \tcode{<cstdbool>}\indexhdr{cstdbool}\iref{depr.cstdbool.syn}
2052-
are meaningless in \Cpp{}. Use of
2053-
the \Cpp{} headers \tcode{<ccomplex>}, \tcode{<cstdalign>}, \tcode{<cstdbool>},
2054-
and \tcode{<ctgmath>} is deprecated\iref{depr.c.headers}.
2141+
The C headers \tcode{<complex.h>}\indexhdr{complex.h} and
2142+
\tcode{<tgmath.h>}\indexhdr{tgmath.h} do not contain any of the content from
2143+
the C standard library and instead merely include other headers from the \Cpp{}
2144+
standard library.
20552145

20562146
\rSec2[diff.mods.to.definitions]{Modifications to definitions}
20572147

@@ -2104,26 +2194,20 @@
21042194
\tcode{xor_eq}
21052195
are keywords in this International
21062196
Standard\iref{lex.key}.
2107-
They do not appear as macro names defined in
2108-
\tcode{<ciso646>}.
2109-
\indexhdr{ciso646}%
21102197

21112198
\rSec3[diff.header.stdalign.h]{Header \tcode{<stdalign.h>}}
21122199
\indexhdr{stdalign.h}%
21132200

21142201
\pnum
21152202
The token \tcode{alignas} is a keyword in this International
2116-
Standard\iref{lex.key}. It does not appear as a macro name defined
2117-
in \tcode{<cstdalign>}\indexhdr{cstdalign}\iref{depr.cstdalign.syn}.
2203+
Standard\iref{lex.key}.
21182204

21192205
\rSec3[diff.header.stdbool.h]{Header \tcode{<stdbool.h>}}
21202206
\indexhdr{stdbool.h}%
21212207

21222208
\pnum
21232209
The tokens \tcode{bool}, \tcode{true}, and \tcode{false}
21242210
are keywords in this International Standard\iref{lex.key}.
2125-
They do not appear as macro names defined in
2126-
\tcode{<cstdbool>}\indexhdr{cstdbool}\iref{depr.cstdbool.syn}.
21272211

21282212
\rSec3[diff.null]{Macro \tcode{NULL}}
21292213

source/containers.tex

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5628,6 +5628,7 @@
56285628
friend class vector;
56295629
reference() noexcept;
56305630
public:
5631+
reference(const reference&) = default;
56315632
~reference();
56325633
operator bool() const noexcept;
56335634
reference& operator=(const bool x) noexcept;

source/exceptions.tex

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -705,7 +705,6 @@
705705
\nontermdef{noexcept-specifier}\br
706706
\terminal{noexcept} \terminal{(} constant-expression \terminal{)}\br
707707
\terminal{noexcept}\br
708-
\terminal{throw} \terminal{(} \terminal{)}
709708
\end{bnf}
710709

711710
\pnum
@@ -723,10 +722,6 @@
723722
is
724723
equivalent to the \grammarterm{noexcept-specifier}
725724
\tcode{noexcept(true)}.
726-
The \grammarterm{noexcept-specifier} \tcode{throw()}
727-
is deprecated\iref{depr.except.spec}, and
728-
equivalent to the \grammarterm{noexcept-specifier}
729-
\tcode{noexcept(true)}.
730725

731726
\pnum
732727
If a declaration of a function
@@ -920,7 +915,7 @@
920915
~A();
921916
};
922917
struct B {
923-
B() throw();
918+
B() noexcept;
924919
B(const B&) = default; // implicit exception specification is \tcode{noexcept(true)}
925920
B(B&&, int = (throw Y(), 0)) noexcept;
926921
~B() noexcept(false);

0 commit comments

Comments
 (0)