hicpp-exception-baseclass

确保在 throw 表达式中,每个值都是 std::exception 的实例。

这强制执行了 High Integrity C++ 编码标准的第 15.1 条规则

class custom_exception {};

void throwing() noexcept(false) {
  // Problematic throw expressions.
  throw int(42);
  throw custom_exception();
}

class mathematical_error : public std::exception {};

void throwing2() noexcept(false) {
  // These kind of throws are ok.
  throw mathematical_error();
  throw std::runtime_error();
  throw std::exception();
}