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 []/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 says about the type of main and remains unchanged.

  These cases should be addressed as CWG issue(s) IMO.


Jiang An