From 925066843dbd2f08eeb2ed6b97406b68e6d7c86f Mon Sep 17 00:00:00 2001 From: Jens Maurer Date: Thu, 30 Nov 2017 23:42:08 +0100 Subject: [PATCH] [language.support, utilities] Condense description of exception classes --- source/support.tex | 64 ++++++++++++-------------------------------- source/utilities.tex | 64 ++++++++++++-------------------------------- source/xrefdelta.tex | 3 +++ 3 files changed, 37 insertions(+), 94 deletions(-) diff --git a/source/support.tex b/source/support.tex index 731c8b7963..c72478cd14 100644 --- a/source/support.tex +++ b/source/support.tex @@ -2731,9 +2731,7 @@ namespace std { class bad_alloc : public exception { public: - bad_alloc() noexcept; - bad_alloc(const bad_alloc&) noexcept; - bad_alloc& operator=(const bad_alloc&) noexcept; + // see \ref{exception} for the specification of the special member functions const char* what() const noexcept override; }; } @@ -2754,12 +2752,6 @@ \pnum \returns An \impldef{return value of \tcode{bad_alloc::what}} \ntbs{}. - -\pnum -\remarks -The message may be a null-terminated multibyte string\iref{multibyte.strings}, -suitable for conversion and display as a -\tcode{wstring}~(\ref{string.classes}, \ref{locale.codecvt}). \end{itemdescr} \indexlibrary{\idxcode{bad_array_new_length}}% @@ -2770,7 +2762,7 @@ namespace std { class bad_array_new_length : public bad_alloc { public: - bad_array_new_length() noexcept; + // see \ref{exception} for the specification of the special member functions const char* what() const noexcept override; }; } @@ -2791,12 +2783,6 @@ \pnum \returns An \impldef{return value of \tcode{bad_array_new_length::what}} \ntbs{}. - -\pnum -\remarks -The message may be a null-terminated multibyte string\iref{multibyte.strings}, -suitable for conversion and display as a -\tcode{wstring}~(\ref{string.classes}, \ref{locale.codecvt}). \end{itemdescr} \rSec3[new.handler]{Type \tcode{new_handler}} @@ -3124,9 +3110,7 @@ namespace std { class bad_cast : public exception { public: - bad_cast() noexcept; - bad_cast(const bad_cast&) noexcept; - bad_cast& operator=(const bad_cast&) noexcept; + // see \ref{exception} for the specification of the special member functions const char* what() const noexcept override; }; } @@ -3150,12 +3134,6 @@ \pnum \returns An \impldef{return value of \tcode{bad_cast::what}} \ntbs{}. - -\pnum -\remarks -The message may be a null-terminated multibyte string\iref{multibyte.strings}, -suitable for conversion and display as a -\tcode{wstring}~(\ref{string.classes}, \ref{locale.codecvt}) \end{itemdescr} \rSec2[bad.typeid]{Class \tcode{bad_typeid}} @@ -3166,9 +3144,7 @@ namespace std { class bad_typeid : public exception { public: - bad_typeid() noexcept; - bad_typeid(const bad_typeid&) noexcept; - bad_typeid& operator=(const bad_typeid&) noexcept; + // see \ref{exception} for the specification of the special member functions const char* what() const noexcept override; }; } @@ -3192,12 +3168,6 @@ \pnum \returns An \impldef{return value of \tcode{bad_typeid::what}} \ntbs{}. - -\pnum -\remarks -The message may be a null-terminated multibyte string\iref{multibyte.strings}, -suitable for conversion and display as a -\tcode{wstring}~(\ref{string.classes}, \ref{locale.codecvt}) \end{itemdescr} \rSec1[support.contract]{Contract violation handling} @@ -3353,12 +3323,20 @@ expressions, to report errors detected during program execution. \pnum -Each standard library class \tcode{T} that derives from class \tcode{exception} shall have a -publicly accessible copy constructor and a publicly accessible copy assignment -operator that do not exit with an exception. These member functions shall meet +Each standard library class \tcode{T} that derives from class \tcode{exception} +has the following publicly accessible member functions, each of them having +a non-throwing exception specification\iref{except.spec}: +\begin{itemize} +\item default constructor (unless the class synopsis shows other constructors) +\item copy constructor +\item copy assignment operator +\end{itemize} +The copy constructor and the copy assignment operator meet the following postcondition: If two objects \tcode{lhs} and \tcode{rhs} both have dynamic type \tcode{T} and \tcode{lhs} is a copy of \tcode{rhs}, then -\tcode{strcmp(lhs.what(), rhs.what())} shall equal 0. +\tcode{strcmp(lhs.what(), rhs.what())} is equal to \tcode{0}. +The \tcode{what()} member function of each such \tcode{T} satisfies the +constraints specified for \tcode{exception::what()} (see below). \indexlibrary{\idxcode{exception}!constructor}% \indexlibrarymember{operator=}{exception}% @@ -3413,9 +3391,7 @@ namespace std { class bad_exception : public exception { public: - bad_exception() noexcept; - bad_exception(const bad_exception&) noexcept; - bad_exception& operator=(const bad_exception&) noexcept; + // see \ref{exception} for the specification of the special member functions const char* what() const noexcept override; }; } @@ -3438,12 +3414,6 @@ \pnum \returns An \impldef{return value of \tcode{bad_exception::what}} \ntbs{}. - -\pnum -\remarks -The message may be a null-terminated multibyte string\iref{multibyte.strings}, -suitable for conversion and display as a -\tcode{wstring}~(\ref{string.classes}, \ref{locale.codecvt}). \end{itemdescr} \rSec2[exception.terminate]{Abnormal termination} diff --git a/source/utilities.tex b/source/utilities.tex index 48b976268c..1dce51ba71 100644 --- a/source/utilities.tex +++ b/source/utilities.tex @@ -3142,29 +3142,23 @@ \begin{codeblock} class bad_optional_access : public exception { public: - bad_optional_access(); + // see \ref{exception} for the specification of the special member functions + const char* what() const noexcept override; }; \end{codeblock} \pnum The class \tcode{bad_optional_access} defines the type of objects thrown as exceptions to report the situation where an attempt is made to access the value of an optional object that does not contain a value. -\indexlibrary{\idxcode{bad_optional_access}!constructor}% \indexlibrarymember{what}{bad_optional_access}% \begin{itemdecl} -bad_optional_access(); +const char* what() const noexcept override; \end{itemdecl} \begin{itemdescr} \pnum -\effects -Constructs an object of class \tcode{bad_optional_access}. - -\pnum -\ensures -\tcode{what()} returns an -\impldef{return value of \tcode{bad_optional_access::what}} -\ntbs{}. +\returns +An \impldef{return value of \tcode{bad_optional_access::what}} \ntbs{}. \end{itemdescr} \rSec2[optional.relops]{Relational operators} @@ -4992,7 +4986,7 @@ \begin{codeblock} class bad_variant_access : public exception { public: - bad_variant_access() noexcept; + // see \ref{exception} for the specification of the special member functions const char* what() const noexcept override; }; \end{codeblock} @@ -5001,16 +4995,6 @@ Objects of type \tcode{bad_variant_access} are thrown to report invalid accesses to the value of a \tcode{variant} object. -\indexlibrary{\idxcode{bad_variant_access}!constructor}% -\begin{itemdecl} -bad_variant_access() noexcept; -\end{itemdecl} - -\begin{itemdescr} -\pnum -Constructs a \tcode{bad_variant_access} object. -\end{itemdescr} - \indexlibrarymember{what}{bad_variant_access}% \begin{itemdecl} const char* what() const noexcept override; @@ -5098,6 +5082,7 @@ \begin{codeblock} class bad_any_cast : public bad_cast { public: + // see \ref{exception} for the specification of the special member functions const char* what() const noexcept override; }; \end{codeblock} @@ -5113,11 +5098,6 @@ \begin{itemdescr} \pnum \returns An \impldef{return value of \tcode{bad_any_cast::what}} \ntbs{}. - -\pnum -\remarks -The message may be a null-terminated multibyte string\iref{multibyte.strings}, -suitable for conversion and display as a wstring~(\ref{string.classes}, \ref{locale.codecvt}). \end{itemdescr} \rSec2[any.class]{Class \tcode{any}} @@ -9972,7 +9952,8 @@ namespace std { class bad_weak_ptr : public exception { public: - bad_weak_ptr() noexcept; + // see \ref{exception} for the specification of the special member functions + const char* what() const noexcept override; }; } \end{codeblock} @@ -9981,16 +9962,15 @@ An exception of type \tcode{bad_weak_ptr} is thrown by the \tcode{shared_ptr} constructor taking a \tcode{weak_ptr}. -\indexlibrary{\idxcode{bad_weak_ptr}!constructor}% \indexlibrarymember{what}{bad_weak_ptr}% \begin{itemdecl} -bad_weak_ptr() noexcept; +const char* what() const noexcept override; \end{itemdecl} \begin{itemdescr} -\pnum\ensures \tcode{what()} returns an -\impldef{return value of \tcode{bad_weak_ptr::what}} \ntbs{}. - +\pnum +\returns +An \impldef{return value of \tcode{bad_weak_ptr::what}} \ntbs{}. \end{itemdescr} \rSec2[util.smartptr.shared]{Class template \tcode{shared_ptr}} @@ -15600,26 +15580,16 @@ namespace std { class bad_function_call : public exception { public: - // \ref{func.wrap.badcall.const}, constructor - bad_function_call() noexcept; + // see \ref{exception} for the specification of the special member functions + const char* what() const noexcept override; }; } \end{codeblock} -\rSec4[func.wrap.badcall.const]{Constructor} - -\indexlibrary{\idxcode{bad_function_call}!constructor}% \indexlibrarymember{what}{bad_function_call}% -\begin{itemdecl} -bad_function_call() noexcept; -\end{itemdecl} - \begin{itemdescr} -\pnum\effects Constructs a \tcode{bad_function_call} object. -\end{itemdescr} - -\begin{itemdescr} -\pnum\ensures \tcode{what()} returns an +\pnum +\returns An \impldef{return value of \tcode{bad_function_call::what}} \ntbs{}. \end{itemdescr} diff --git a/source/xrefdelta.tex b/source/xrefdelta.tex index 38c0929ec5..f045d680ff 100644 --- a/source/xrefdelta.tex +++ b/source/xrefdelta.tex @@ -282,6 +282,9 @@ \movedxref{time.traits.is_fp}{time.traits.is.fp} \movedxref{utility.as_const}{utility.as.const} +% Dissolved subclause. +\movedxref{func.wrap.badcall.const}{func.wrap.badcall} + % Deprecated features. %\deprxref{old.label} (if moved to depr.old.label, otherwise use \movedxref)