"This kind of function may not throw. Declare it 'noexcept'."

C++ Core Guidelines: F.6: If your function may not throw, declare it noexcept

Some kinds of operations should never cause exceptions. Their implementations should be reliable and should handle possible errors conditions gracefully. They should never use exceptions to indicate failure. This rule flags cases where such operations are not explicitly marked as ‘noexcept’ which means that they may throw exceptions and cannot convey assumptions about their reliability.


  • Special kinds of operations are the following:
    • destructors;
    • default constructors;
    • move constructors and move assignment operators;
    • standard functions with move semantics: std::move and std::swap.
    • Non-standard and outdated specifiers like throw() or declspec(nothrow) are not equivalent to ‘noexcept’.
    • Explicit specifiers noexcept(false) and noexcept(true) are respected appropriately.
    • The warning may still appear for operations that are marked as constexpr. This may change in future releases.