aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Cano2016-06-14 18:33:10 -0700
committerGitHub2016-06-14 18:33:10 -0700
commitcdbb5934d7522e2e9c966fbfdcaa8d0647bc2c1c (patch)
tree523973575a9d1992f061954f282170521deee5c6
parent6c14deb5b8e377a7bdc1a44d91458f17a4f24981 (diff)
downloadTrie-cdbb5934d7522e2e9c966fbfdcaa8d0647bc2c1c.tar
Trie-cdbb5934d7522e2e9c966fbfdcaa8d0647bc2c1c.tar.gz
Trie-cdbb5934d7522e2e9c966fbfdcaa8d0647bc2c1c.tar.bz2
Trie-cdbb5934d7522e2e9c966fbfdcaa8d0647bc2c1c.tar.lz
Trie-cdbb5934d7522e2e9c966fbfdcaa8d0647bc2c1c.tar.xz
Trie-cdbb5934d7522e2e9c966fbfdcaa8d0647bc2c1c.tar.zst
Trie-cdbb5934d7522e2e9c966fbfdcaa8d0647bc2c1c.zip
Evaluation order in this case is unspecified
On Visual C++ 2010, the `++current` was being evaluated before `[*current]`, causing a deref of `end` and a crash.
-rw-r--r--src/trie.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/trie.h b/src/trie.h
index d34912f..1fa698e 100644
--- a/src/trie.h
+++ b/src/trie.h
@@ -77,7 +77,8 @@ class Trie {
typename key_list::const_iterator end
) {
if ( current != end ) {
- return this->children_[*current].add(++current, end);
+ auto element = *current;
+ return this->children_[element].add(++current, end);
} else {
return this;
}