From 49b6de46afac29898d47c1f38f1ad0b57ea041af Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Wed, 19 Apr 2017 08:03:46 +0200 Subject: Fix typification bug in variable_cache --- build2/variable.txx | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'build2/variable.txx') diff --git a/build2/variable.txx b/build2/variable.txx index 038f107..c7d3e5a 100644 --- a/build2/variable.txx +++ b/build2/variable.txx @@ -557,7 +557,7 @@ namespace build2 // template pair variable_cache:: - insert (K k, const lookup& stem, size_t ver) + insert (K k, const lookup& stem, size_t ver, const variable& var) { using value_data = variable_map::value_data; @@ -580,7 +580,8 @@ namespace build2 if (i != m_.end () && i->second.version == ver && i->second.stem_vars == svars && - i->second.stem_version == sver) + i->second.stem_version == sver && + (var.type == nullptr || i->second.value.type == var.type)) return pair (i->second.value, move (ul)); // Relock for exclusive access. Note that it is entirely possible @@ -625,9 +626,14 @@ namespace build2 e.value.version++; // Value changed. } else + { // Cache hit. // + if (var.type != nullptr && e.value.type != var.type) + typify (e.value, *var.type, &var); + ul.unlock (); + } return pair (e.value, move (ul)); } -- cgit v1.1