C++ Logo

std-discussion

Advanced search

Missing changes in P0012R1

From: v.S. F. <de34_at_[hidden]>
Date: Wed, 17 Mar 2021 08:05:31 +0000
  Since C++17 (via P0012R1), except specifications have became part of the type system, and a noexcept function is implicitly convertible to a pointer to a non-noexcept function. However, it seems that calling a noexcept function through a pointer to a non-noexcept function is UB, as [expr.call]/6<https://eel.is/c++draft/expr.call#6> remains unchanged (known compilers accept such call in constant evaluation in C++17 and later modes).
  In the other hand, the definition “int main() noexcept {}” was guaranteed to be supported in C++11/14 (as noexcept was not part of the function type), but the guarantee is removed by P0012R1, because [basic.start.main]/2<https://eel.is/c++draft/basic.start.main#2> says about the type of main and remains unchanged.
  These cases should be addressed as CWG issue(s) IMO.

Jiang An

Received on 2021-03-17 03:05:37