aboutsummaryrefslogtreecommitdiff
path: root/gcc/hash-map.h
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2018-11-14 17:43:38 +0100
committerJakub Jelinek <jakub@gcc.gnu.org>2018-11-14 17:43:38 +0100
commit12763abc53bb8c4d9953992b003f4a59a59473ce (patch)
treef010ba1b3916800122991c9f7dbb6e03754bcbe2 /gcc/hash-map.h
parentc933b893537f9d73a73ea70c551bdfca363ff5d8 (diff)
downloadgcc-12763abc53bb8c4d9953992b003f4a59a59473ce.zip
gcc-12763abc53bb8c4d9953992b003f4a59a59473ce.tar.gz
gcc-12763abc53bb8c4d9953992b003f4a59a59473ce.tar.bz2
re PR bootstrap/86739 (Bootstrap broken with host GCC 4.1.2)
PR bootstrap/86739 * hash-map.h (hash_map::iterator::reference_pair): New class. (hash_map::iterator::operator*): Return it rather than std::pair. From-SVN: r266152
Diffstat (limited to 'gcc/hash-map.h')
-rw-r--r--gcc/hash-map.h17
1 files changed, 15 insertions, 2 deletions
diff --git a/gcc/hash-map.h b/gcc/hash-map.h
index 3984828..5cee4a4 100644
--- a/gcc/hash-map.h
+++ b/gcc/hash-map.h
@@ -223,10 +223,23 @@ public:
return *this;
}
- std::pair<const Key&, Value&> operator* ()
+ /* Can't use std::pair here, because GCC before 4.3 don't handle
+ std::pair where template parameters are references well.
+ See PR86739. */
+ struct reference_pair {
+ const Key &first;
+ Value &second;
+
+ reference_pair (const Key &key, Value &value) : first (key), second (value) {}
+
+ template <typename K, typename V>
+ operator std::pair<K, V> () const { return std::pair<K, V> (first, second); }
+ };
+
+ reference_pair operator* ()
{
hash_entry &e = *m_iter;
- return std::pair<const Key&, Value&> (e.m_key, e.m_value);
+ return reference_pair (e.m_key, e.m_value);
}
bool