As of c++20 we can define immediate functions by using the consteval
specifier. When a function is declared consteval
every call to that function must produce a compile-time constant otherwise the program is ill-formed. Also, since c++20 try-catch blocks are allowed in constant evaluated contexts but throwing exceptions is still disallowed. Because of this I initially thought that as consteval
implies inline
it also implies noexcept
since throwing any exception is forbidden. As you can imagine at this point, this is not true: unless you specify noexcept
, an immediate function is a potentially throwing function with all the negative sides that derive from that. Is there a reason for this I'm not aware of?
评论
请
登录后发表观点
- 积分
0 - 话题
0 - 评论
3261 - 注册排名
1734