aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--build2/variable.hxx2
-rw-r--r--build2/variable.ixx12
-rw-r--r--old-tests/amalgam/unnamed/test.out2
3 files changed, 14 insertions, 2 deletions
diff --git a/build2/variable.hxx b/build2/variable.hxx
index 01e7038..782cc2b 100644
--- a/build2/variable.hxx
+++ b/build2/variable.hxx
@@ -916,7 +916,7 @@ namespace build2
static project_name convert (name&&, name*);
static void assign (value&, project_name&&);
- static name reverse (const project_name& x) {return name (x.string ());}
+ static name reverse (const project_name&);
static int compare (const project_name& x, const project_name& y) {
return x.compare (y);}
static bool empty (const project_name& x) {return x.empty ();}
diff --git a/build2/variable.ixx b/build2/variable.ixx
index a92ef3c..559151b 100644
--- a/build2/variable.ixx
+++ b/build2/variable.ixx
@@ -641,6 +641,18 @@ namespace build2
new (&v.data_) project_name (move (x));
}
+ inline name value_traits<project_name>::
+ reverse (const project_name& x)
+ {
+ // Make work for the special unnamed subproject representation (see
+ // find_subprojects() in file.cxx for details).
+ //
+ const string& s (x.string ());
+ return name (s.empty () || path::traits_type::is_separator (s.back ())
+ ? empty_string
+ : s);
+ }
+
// vector<T> value
//
template <typename T>
diff --git a/old-tests/amalgam/unnamed/test.out b/old-tests/amalgam/unnamed/test.out
index 023b71f..33ae811 100644
--- a/old-tests/amalgam/unnamed/test.out
+++ b/old-tests/amalgam/unnamed/test.out
@@ -1,2 +1,2 @@
''
-sub/@sub/
+{}@sub/