Skip to content

Commit

Permalink
Cut noexcept calculations in dynamic-inl.h
Browse files Browse the repository at this point in the history
Summary:
- GCC 4.9 previously required marking `TypeError` special member
  functions with conditional noexcept.
- GCC 5.1 does not have this issue. So, remove the conditional noexcept
  as they always evalaute to true in the existing code.
  • Loading branch information
JoeLoser committed Feb 27, 2019
1 parent 223aae6 commit 3475baa
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 18 deletions.
14 changes: 4 additions & 10 deletions folly/dynamic-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -134,16 +134,10 @@ struct FOLLY_EXPORT TypeError : std::runtime_error {
const std::string& expected,
dynamic::Type actual1,
dynamic::Type actual2);
// TODO: noexcept calculation required through gcc-v4.9; remove once upgrading
// to gcc-v5.
TypeError(const TypeError&) noexcept(
std::is_nothrow_copy_constructible<std::runtime_error>::value);
TypeError& operator=(const TypeError&) noexcept(
std::is_nothrow_copy_assignable<std::runtime_error>::value);
TypeError(TypeError&&) noexcept(
std::is_nothrow_move_constructible<std::runtime_error>::value);
TypeError& operator=(TypeError&&) noexcept(
std::is_nothrow_move_assignable<std::runtime_error>::value);
TypeError(const TypeError&) noexcept;
TypeError& operator=(const TypeError&) noexcept;
TypeError(TypeError&&) noexcept;
TypeError& operator=(TypeError&&) noexcept;
~TypeError() override;
};

Expand Down
12 changes: 4 additions & 8 deletions folly/dynamic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,10 @@ TypeError::TypeError(
dynamic::typeName(actual1),
dynamic::typeName(actual2))) {}

TypeError::TypeError(const TypeError&) noexcept(
std::is_nothrow_copy_constructible<std::runtime_error>::value) = default;
TypeError& TypeError::operator=(const TypeError&) noexcept(
std::is_nothrow_copy_assignable<std::runtime_error>::value) = default;
TypeError::TypeError(TypeError&&) noexcept(
std::is_nothrow_move_constructible<std::runtime_error>::value) = default;
TypeError& TypeError::operator=(TypeError&&) noexcept(
std::is_nothrow_move_assignable<std::runtime_error>::value) = default;
TypeError::TypeError(const TypeError&) noexcept = default;
TypeError& TypeError::operator=(const TypeError&) noexcept = default;
TypeError::TypeError(TypeError&&) noexcept = default;
TypeError& TypeError::operator=(TypeError&&) noexcept = default;
TypeError::~TypeError() = default;

// This is a higher-order preprocessor macro to aid going from runtime
Expand Down

0 comments on commit 3475baa

Please sign in to comment.