summaryrefslogtreecommitdiff
path: root/src/value.cc
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2010-06-10 16:32:24 -0400
committerJohn Wiegley <johnw@newartisans.com>2010-06-10 16:32:24 -0400
commit92d2eb957407c16d1eca3598e00e6c16cbe4e7e7 (patch)
treebaea9d1514cd878a7cfe9396e497f7d08d134e0d /src/value.cc
parent5659b6fb37b8601c39be6ecec3c8c86625686e0f (diff)
downloadfork-ledger-92d2eb957407c16d1eca3598e00e6c16cbe4e7e7.tar.gz
fork-ledger-92d2eb957407c16d1eca3598e00e6c16cbe4e7e7.tar.bz2
fork-ledger-92d2eb957407c16d1eca3598e00e6c16cbe4e7e7.zip
Use ptr_deque for value_t::sequence_t
This is to work around undefined behavior according to the Standard, [lib.res.on.functions]/2: "In particular, the effects are undefined in the following cases: [..] - if an incomplete type (3.9) is used as a template argument when instantiating a template component."
Diffstat (limited to 'src/value.cc')
-rw-r--r--src/value.cc6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/value.cc b/src/value.cc
index 33461c5a..74dd843d 100644
--- a/src/value.cc
+++ b/src/value.cc
@@ -343,7 +343,7 @@ value_t& value_t::operator+=(const value_t& val)
throw_(value_error, _("Cannot add sequences of different lengths"));
}
} else {
- as_sequence_lval().push_back(val);
+ as_sequence_lval().push_back(new value_t(val));
}
return *this;
}
@@ -1110,7 +1110,7 @@ void value_t::in_place_cast(type_t cast_type)
else if (cast_type == SEQUENCE) {
sequence_t temp;
if (! is_null())
- temp.push_back(*this);
+ temp.push_back(new value_t(*this));
set_sequence(temp);
return;
}
@@ -1693,7 +1693,7 @@ value_t value_t::strip_annotations(const keep_details_t& what_to_keep) const
case SEQUENCE: {
sequence_t temp;
foreach (const value_t& value, as_sequence())
- temp.push_back(value.strip_annotations(what_to_keep));
+ temp.push_back(new value_t(value.strip_annotations(what_to_keep)));
return temp;
}