Rokiのチラ裏

学生による学習のログ

clangでのnoexcept、式が定数式の場合でも0を送出する事がある

定義済みのconstexpr関数をop noexceptへ渡すと0が送出されているが、これは規格準拠の挙動ではない。

The result of the noexcept operator is false if in a potentially-evaluated context the expression would contain a potentially-evaluated call to a function, member function, function pointer, or member function pointer that does not have a non-throwing exception-specification (15.4), *unless the call is a constant expression (5.19)* - [expr.unary.noexcept]p3

因みにGCCでは実装されている。