From 60a95915aa1fda93d308158416071ba39286d41c Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Wed, 11 Nov 2020 15:05:30 +0200 Subject: Make value_traits::convert() non-modifying --- libbuild2/variable.cxx | 2 +- libbuild2/variable.hxx | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/libbuild2/variable.cxx b/libbuild2/variable.cxx index 91b25bd..f5476b5 100644 --- a/libbuild2/variable.cxx +++ b/libbuild2/variable.cxx @@ -460,7 +460,7 @@ namespace build2 // bool value // bool value_traits:: - convert (name&& n, name* r) + convert (const name& n, const name* r) { if (r == nullptr && n.simple ()) { diff --git a/libbuild2/variable.hxx b/libbuild2/variable.hxx index 3152c71..a671978 100644 --- a/libbuild2/variable.hxx +++ b/libbuild2/variable.hxx @@ -704,7 +704,10 @@ namespace build2 { static_assert (sizeof (bool) <= value::size_, "insufficient space"); - static bool convert (name&&, name*); + // Note: in some places we rely on the convert() function not changing + // the passed names thus we make them const. + // + static bool convert (const name&, const name*); static void assign (value&, bool); static void append (value&, bool); // OR. static name reverse (bool x) {return name (x ? "true" : "false");} -- cgit v1.1