|
607 | 607 | #define @\defnlibxname{cpp_lib_constexpr_cmath}@ 202306L // also in \libheader{cmath}, \libheader{cstdlib} |
608 | 608 | #define @\defnlibxname{cpp_lib_constexpr_complex}@ 202306L // also in \libheader{complex} |
609 | 609 | #define @\defnlibxname{cpp_lib_constexpr_dynamic_alloc}@ 201907L // also in \libheader{memory} |
| 610 | +#define @\defnlibxname{cpp_lib_constexpr_exceptions}@ 202411L // also in \libheader{exception} |
610 | 611 | #define @\defnlibxname{cpp_lib_constexpr_functional}@ 201907L // freestanding, also in \libheader{functional} |
611 | 612 | #define @\defnlibxname{cpp_lib_constexpr_iterator}@ 201811L // freestanding, also in \libheader{iterator} |
612 | 613 | #define @\defnlibxname{cpp_lib_constexpr_memory}@ 202202L // freestanding, also in \libheader{memory} |
|
2941 | 2942 | class bad_alloc : public exception { |
2942 | 2943 | public: |
2943 | 2944 | // see \ref{exception} for the specification of the special member functions |
2944 | | - const char* what() const noexcept override; |
| 2945 | + constexpr const char* what() const noexcept override; |
2945 | 2946 | }; |
2946 | 2947 | } |
2947 | 2948 | \end{codeblock} |
|
2954 | 2955 |
|
2955 | 2956 | \indexlibrarymember{what}{bad_alloc}% |
2956 | 2957 | \begin{itemdecl} |
2957 | | -const char* what() const noexcept override; |
| 2958 | +constexpr const char* what() const noexcept override; |
2958 | 2959 | \end{itemdecl} |
2959 | 2960 |
|
2960 | 2961 | \begin{itemdescr} |
|
2972 | 2973 | class bad_array_new_length : public bad_alloc { |
2973 | 2974 | public: |
2974 | 2975 | // see \ref{exception} for the specification of the special member functions |
2975 | | - const char* what() const noexcept override; |
| 2976 | + constexpr const char* what() const noexcept override; |
2976 | 2977 | }; |
2977 | 2978 | } |
2978 | 2979 | \end{codeblock} |
|
2985 | 2986 |
|
2986 | 2987 | \indexlibrarymember{what}{bad_array_new_length}% |
2987 | 2988 | \begin{itemdecl} |
2988 | | -const char* what() const noexcept override; |
| 2989 | +constexpr const char* what() const noexcept override; |
2989 | 2990 | \end{itemdecl} |
2990 | 2991 |
|
2991 | 2992 | \begin{itemdescr} |
|
3310 | 3311 | class bad_cast : public exception { |
3311 | 3312 | public: |
3312 | 3313 | // see \ref{exception} for the specification of the special member functions |
3313 | | - const char* what() const noexcept override; |
| 3314 | + constexpr const char* what() const noexcept override; |
3314 | 3315 | }; |
3315 | 3316 | } |
3316 | 3317 | \end{codeblock} |
|
3326 | 3327 |
|
3327 | 3328 | \indexlibrarymember{what}{bad_cast}% |
3328 | 3329 | \begin{itemdecl} |
3329 | | -const char* what() const noexcept override; |
| 3330 | +constexpr const char* what() const noexcept override; |
3330 | 3331 | \end{itemdecl} |
3331 | 3332 |
|
3332 | 3333 | \begin{itemdescr} |
|
3344 | 3345 | class bad_typeid : public exception { |
3345 | 3346 | public: |
3346 | 3347 | // see \ref{exception} for the specification of the special member functions |
3347 | | - const char* what() const noexcept override; |
| 3348 | + constexpr const char* what() const noexcept override; |
3348 | 3349 | }; |
3349 | 3350 | } |
3350 | 3351 | \end{codeblock} |
|
3360 | 3361 |
|
3361 | 3362 | \indexlibrarymember{what}{bad_typeid}% |
3362 | 3363 | \begin{itemdecl} |
3363 | | -const char* what() const noexcept override; |
| 3364 | +constexpr const char* what() const noexcept override; |
3364 | 3365 | \end{itemdecl} |
3365 | 3366 |
|
3366 | 3367 | \begin{itemdescr} |
|
3775 | 3776 | terminate_handler set_terminate(terminate_handler f) noexcept; |
3776 | 3777 | [[noreturn]] void terminate() noexcept; |
3777 | 3778 |
|
3778 | | - int uncaught_exceptions() noexcept; |
| 3779 | + constexpr int uncaught_exceptions() noexcept; |
3779 | 3780 |
|
3780 | 3781 | using exception_ptr = @\unspec@; |
3781 | 3782 |
|
3782 | | - exception_ptr current_exception() noexcept; |
3783 | | - [[noreturn]] void rethrow_exception(exception_ptr p); |
3784 | | - template<class E> exception_ptr make_exception_ptr(E e) noexcept; |
| 3783 | + constexpr exception_ptr current_exception() noexcept; |
| 3784 | + [[noreturn]] constexpr void rethrow_exception(exception_ptr p); |
| 3785 | + template<class E> constexpr exception_ptr make_exception_ptr(E e) noexcept; |
3785 | 3786 |
|
3786 | | - template<class T> [[noreturn]] void throw_with_nested(T&& t); |
3787 | | - template<class E> void rethrow_if_nested(const E& e); |
| 3787 | + template<class T> [[noreturn]] constexpr void throw_with_nested(T&& t); |
| 3788 | + template<class E> constexpr void rethrow_if_nested(const E& e); |
3788 | 3789 | } |
3789 | 3790 | \end{codeblock} |
3790 | 3791 |
|
|
3796 | 3797 | namespace std { |
3797 | 3798 | class exception { |
3798 | 3799 | public: |
3799 | | - exception() noexcept; |
3800 | | - exception(const exception&) noexcept; |
3801 | | - exception& operator=(const exception&) noexcept; |
3802 | | - virtual ~exception(); |
3803 | | - virtual const char* what() const noexcept; |
| 3800 | + constexpr exception() noexcept; |
| 3801 | + constexpr exception(const exception&) noexcept; |
| 3802 | + constexpr exception& operator=(const exception&) noexcept; |
| 3803 | + constexpr virtual ~exception(); |
| 3804 | + constexpr virtual const char* what() const noexcept; |
3804 | 3805 | }; |
3805 | 3806 | } |
3806 | 3807 | \end{codeblock} |
|
3833 | 3834 | \indexlibraryctor{exception}% |
3834 | 3835 | \indexlibrarymember{operator=}{exception}% |
3835 | 3836 | \begin{itemdecl} |
3836 | | -exception(const exception& rhs) noexcept; |
3837 | | -exception& operator=(const exception& rhs) noexcept; |
| 3837 | +constexpr exception(const exception& rhs) noexcept; |
| 3838 | +constexpr exception& operator=(const exception& rhs) noexcept; |
3838 | 3839 | \end{itemdecl} |
3839 | 3840 |
|
3840 | 3841 | \begin{itemdescr} |
|
3846 | 3847 |
|
3847 | 3848 | \indexlibrarydtor{exception}% |
3848 | 3849 | \begin{itemdecl} |
3849 | | -virtual ~exception(); |
| 3850 | +constexpr virtual ~exception(); |
3850 | 3851 | \end{itemdecl} |
3851 | 3852 |
|
3852 | 3853 | \begin{itemdescr} |
|
3858 | 3859 |
|
3859 | 3860 | \indexlibrarymember{what}{exception}% |
3860 | 3861 | \begin{itemdecl} |
3861 | | -virtual const char* what() const noexcept; |
| 3862 | +constexpr virtual const char* what() const noexcept; |
3862 | 3863 | \end{itemdecl} |
3863 | 3864 |
|
3864 | 3865 | \begin{itemdescr} |
3865 | 3866 | \pnum |
3866 | 3867 | \returns |
3867 | | -An \impldef{return value of \tcode{exception::what}} \ntbs{}. |
| 3868 | +An \impldef{return value of \tcode{exception::what}} \ntbs{}, |
| 3869 | +which during constant evaluation is encoded with |
| 3870 | +the ordinary literal encoding\iref{lex.ccon}. |
3868 | 3871 |
|
3869 | 3872 | \pnum |
3870 | 3873 | \remarks |
|
3885 | 3888 | class bad_exception : public exception { |
3886 | 3889 | public: |
3887 | 3890 | // see \ref{exception} for the specification of the special member functions |
3888 | | - const char* what() const noexcept override; |
| 3891 | + constexpr const char* what() const noexcept override; |
3889 | 3892 | }; |
3890 | 3893 | } |
3891 | 3894 | \end{codeblock} |
|
3900 | 3903 |
|
3901 | 3904 | \indexlibrarymember{what}{bad_exception}% |
3902 | 3905 | \begin{itemdecl} |
3903 | | -const char* what() const noexcept override; |
| 3906 | +constexpr const char* what() const noexcept override; |
3904 | 3907 | \end{itemdecl} |
3905 | 3908 |
|
3906 | 3909 | \begin{itemdescr} |
|
4007 | 4010 |
|
4008 | 4011 | \indexlibraryglobal{uncaught_exceptions}% |
4009 | 4012 | \begin{itemdecl} |
4010 | | -int uncaught_exceptions() noexcept; |
| 4013 | +constexpr int uncaught_exceptions() noexcept; |
4011 | 4014 | \end{itemdecl} |
4012 | 4015 |
|
4013 | 4016 | \begin{itemdescr} |
|
4068 | 4071 | Changes in the number of \tcode{exception_ptr} objects that refer to a |
4069 | 4072 | particular exception do not introduce a data race. |
4070 | 4073 | \end{note} |
| 4074 | + |
| 4075 | +\pnum |
| 4076 | +All member functions are marked \tcode{constexpr}. |
4071 | 4077 | \end{itemdescr} |
4072 | 4078 |
|
4073 | 4079 | \indexlibraryglobal{current_exception}% |
4074 | 4080 | \begin{itemdecl} |
4075 | | -exception_ptr current_exception() noexcept; |
| 4081 | +constexpr exception_ptr current_exception() noexcept; |
4076 | 4082 | \end{itemdecl} |
4077 | 4083 |
|
4078 | 4084 | \begin{itemdescr} |
|
4103 | 4109 |
|
4104 | 4110 | \indexlibraryglobal{rethrow_exception}% |
4105 | 4111 | \begin{itemdecl} |
4106 | | -[[noreturn]] void rethrow_exception(exception_ptr p); |
| 4112 | +[[noreturn]] constexpr void rethrow_exception(exception_ptr p); |
4107 | 4113 | \end{itemdecl} |
4108 | 4114 |
|
4109 | 4115 | \begin{itemdescr} |
|
4131 | 4137 |
|
4132 | 4138 | \indexlibraryglobal{make_exception_ptr}% |
4133 | 4139 | \begin{itemdecl} |
4134 | | -template<class E> exception_ptr make_exception_ptr(E e) noexcept; |
| 4140 | +template<class E> constexpr exception_ptr make_exception_ptr(E e) noexcept; |
4135 | 4141 | \end{itemdecl} |
4136 | 4142 |
|
4137 | 4143 | \begin{itemdescr} |
|
4160 | 4166 | namespace std { |
4161 | 4167 | class nested_exception { |
4162 | 4168 | public: |
4163 | | - nested_exception() noexcept; |
4164 | | - nested_exception(const nested_exception&) noexcept = default; |
4165 | | - nested_exception& operator=(const nested_exception&) noexcept = default; |
4166 | | - virtual ~nested_exception() = default; |
| 4169 | + constexpr nested_exception() noexcept; |
| 4170 | + constexpr nested_exception(const nested_exception&) noexcept = default; |
| 4171 | + constexpr nested_exception& operator=(const nested_exception&) noexcept = default; |
| 4172 | + constexpr virtual ~nested_exception() = default; |
4167 | 4173 |
|
4168 | 4174 | // access functions |
4169 | | - [[noreturn]] void rethrow_nested() const; |
4170 | | - exception_ptr nested_ptr() const noexcept; |
| 4175 | + [[noreturn]] constexpr void rethrow_nested() const; |
| 4176 | + constexpr exception_ptr nested_ptr() const noexcept; |
4171 | 4177 | }; |
4172 | 4178 |
|
4173 | | - template<class T> [[noreturn]] void throw_with_nested(T&& t); |
4174 | | - template<class E> void rethrow_if_nested(const E& e); |
| 4179 | + template<class T> [[noreturn]] constexpr void throw_with_nested(T&& t); |
| 4180 | + template<class E> constexpr void rethrow_if_nested(const E& e); |
4175 | 4181 | } |
4176 | 4182 | \end{codeblock} |
4177 | 4183 |
|
|
4188 | 4194 |
|
4189 | 4195 | \indexlibraryctor{nested_exception}% |
4190 | 4196 | \begin{itemdecl} |
4191 | | -nested_exception() noexcept; |
| 4197 | +constexpr nested_exception() noexcept; |
4192 | 4198 | \end{itemdecl} |
4193 | 4199 |
|
4194 | 4200 | \begin{itemdescr} |
|
4199 | 4205 |
|
4200 | 4206 | \indexlibrarymember{rethrow_nested}{nested_exception}% |
4201 | 4207 | \begin{itemdecl} |
4202 | | -[[noreturn]] void rethrow_nested() const; |
| 4208 | +[[noreturn]] constexpr void rethrow_nested() const; |
4203 | 4209 | \end{itemdecl} |
4204 | 4210 |
|
4205 | 4211 | \begin{itemdescr} |
|
4211 | 4217 |
|
4212 | 4218 | \indexlibrarymember{nested_ptr}{nested_exception}% |
4213 | 4219 | \begin{itemdecl} |
4214 | | -exception_ptr nested_ptr() const noexcept; |
| 4220 | +constexpr exception_ptr nested_ptr() const noexcept; |
4215 | 4221 | \end{itemdecl} |
4216 | 4222 |
|
4217 | 4223 | \begin{itemdescr} |
|
4222 | 4228 |
|
4223 | 4229 | \indexlibrarymember{throw_with_nested}{nested_exception}% |
4224 | 4230 | \begin{itemdecl} |
4225 | | -template<class T> [[noreturn]] void throw_with_nested(T&& t); |
| 4231 | +template<class T> [[noreturn]] constexpr void throw_with_nested(T&& t); |
4226 | 4232 | \end{itemdecl} |
4227 | 4233 |
|
4228 | 4234 | \begin{itemdescr} |
|
4245 | 4251 |
|
4246 | 4252 | \indexlibrarymember{rethrow_if_nested}{nested_exception}% |
4247 | 4253 | \begin{itemdecl} |
4248 | | -template<class E> void rethrow_if_nested(const E& e); |
| 4254 | +template<class E> constexpr void rethrow_if_nested(const E& e); |
4249 | 4255 | \end{itemdecl} |
4250 | 4256 |
|
4251 | 4257 | \begin{itemdescr} |
|
0 commit comments