diff --git a/lang/cpp11/noexcept.md b/lang/cpp11/noexcept.md index 4257e4bcb3..2ac2aff52c 100644 --- a/lang/cpp11/noexcept.md +++ b/lang/cpp11/noexcept.md @@ -56,13 +56,16 @@ struct X { // 例外を送出しない int getValue() const noexcept; //int getValue() const noexcept(true); + + // noexceptは参照修飾と後置戻り値型の間 + auto getString() const & noexcept -> std::string; }; ``` * noexcept[color ff0000] - `noexcept`もしくは`noexcept(trueに評価される整数定数式)`が指定された関数が例外を送出した場合、[`std::terminate()`](/reference/exception/terminate.md)関数を呼び出してプログラムを異常終了させる。その際、[`std::terminate()`](/reference/exception/terminate.md)関数が呼び出される前に、スタックの巻き戻しは起こらない可能性がある。 - 従来の`throw`キーワードによる例外仕様(C++03ではexception specification、C++11ではdynamic exception specificationと呼ばれる仕様)は、C++11以降で非推奨である。 - +- `noexcept`の指定可能な位置は、[参照修飾](/lang/cpp11/ref_qualifier_for_this.md)の後、[戻り値の型を後置する関数宣言構文](/lang/cpp11/trailing_return_types.md)の前である。 ### 式が例外を送出する可能性があるか判定するnoexcept演算子 - 演算子としての`noexcept`は、引数として指定した定数式が例外を送出する可能性があるかどうかをコンパイル時に判定し、`bool`型の定数値を返す