From ccb6cb1abe706ed3e5fddbf5dc2c29725eaa069c Mon Sep 17 00:00:00 2001 From: Johannes Altmanninger Date: Sat, 16 Apr 2022 21:17:12 +0200 Subject: [PATCH] Fix inconsistent noexcept-ness between header/implementation Even though we disable exceptions, we use noexcept in some places to enable certain optimizations in std::vector, see https://en.cppreference.com/w/cpp/utility/move_if_noexcept. Some methods have noexcept only at their declaration (or only at the definition). This will be an error when compiling with "g++ -std=c++17". Make both signatures match. --- src/autoload.h | 2 +- src/complete.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/autoload.h b/src/autoload.h index 64efce9c4..ef468f686 100644 --- a/src/autoload.h +++ b/src/autoload.h @@ -54,7 +54,7 @@ class autoload_t { /// Construct an autoloader that loads from the paths given by \p env_var_name. explicit autoload_t(wcstring env_var_name); - autoload_t(autoload_t &&); + autoload_t(autoload_t &&) noexcept; ~autoload_t(); /// Given a command, get a path to autoload. diff --git a/src/complete.cpp b/src/complete.cpp index 584296d55..d54eb24d9 100644 --- a/src/complete.cpp +++ b/src/complete.cpp @@ -226,9 +226,9 @@ completion_t::completion_t(wcstring comp, wcstring desc, string_fuzzy_match_t ma flags(resolve_auto_space(completion, flags_val)) {} completion_t::completion_t(const completion_t &) = default; -completion_t::completion_t(completion_t &&) = default; +completion_t::completion_t(completion_t &&) noexcept = default; completion_t &completion_t::operator=(const completion_t &) = default; -completion_t &completion_t::operator=(completion_t &&) = default; +completion_t &completion_t::operator=(completion_t &&) noexcept = default; completion_t::~completion_t() = default; __attribute__((always_inline)) static inline bool natural_compare_completions(