aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/variable.hxx
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2022-12-13 22:03:02 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2022-12-15 12:45:07 +0300
commitb3b14171766089890b9e1b44935ed5dbc233c5f8 (patch)
treeb3f0d1471fe5c28187a0d5db0a6eae3822516e7a /libbuild2/variable.hxx
parent3ca670b7b7c71ca67d70cac9dffb2ba6120b2e36 (diff)
Add noexcept to move constructors and move assignment operators
Diffstat (limited to 'libbuild2/variable.hxx')
-rw-r--r--libbuild2/variable.hxx12
1 files changed, 9 insertions, 3 deletions
diff --git a/libbuild2/variable.hxx b/libbuild2/variable.hxx
index 2942f1c..8a0adf8 100644
--- a/libbuild2/variable.hxx
+++ b/libbuild2/variable.hxx
@@ -358,9 +358,13 @@ namespace build2
value&
operator= (nullptr_t) {if (!null) reset (); return *this;}
- value (value&&);
+ // Note that we have the noexcept specification even though copy_ctor()
+ // could potentially throw (for example, for std::map).
+ //
+ value (value&&) noexcept;
+
explicit value (const value&);
- value& operator= (value&&);
+ value& operator= (value&&); // Note: can throw for untyped RHS.
value& operator= (const value&);
value& operator= (reference_wrapper<value>);
value& operator= (reference_wrapper<const value>);
@@ -1859,7 +1863,7 @@ namespace build2
variable_map (const variable_map&, const prerequisite&, bool shared = false);
variable_map&
- operator= (variable_map&& v) {m_ = move (v.m_); return *this;}
+ operator= (variable_map&& v) noexcept {m_ = move (v.m_); return *this;}
variable_map&
operator= (const variable_map& v) {m_ = v.m_; return *this;}
@@ -1870,6 +1874,8 @@ namespace build2
variable_map (context& c, bool shared)
: shared_ (shared), owner_ (owner::context), ctx (&c) {}
+ // Note: std::map's move constructor can throw.
+ //
variable_map (variable_map&& v)
: shared_ (v.shared_), owner_ (v.owner_), ctx (v.ctx), m_ (move (v.m_))
{