diff options
author | Jakub Jelinek <jakub@redhat.com> | 2018-11-14 17:43:38 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2018-11-14 17:43:38 +0100 |
commit | 12763abc53bb8c4d9953992b003f4a59a59473ce (patch) | |
tree | f010ba1b3916800122991c9f7dbb6e03754bcbe2 | |
parent | c933b893537f9d73a73ea70c551bdfca363ff5d8 (diff) | |
download | gcc-12763abc53bb8c4d9953992b003f4a59a59473ce.tar.gz |
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
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/hash-map.h | 17 |
2 files changed, 21 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index be75c6874c8..ae27a137d15 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2018-11-14 Jakub Jelinek <jakub@redhat.com> + + PR bootstrap/86739 + * hash-map.h (hash_map::iterator::reference_pair): New class. + (hash_map::iterator::operator*): Return it rather than std::pair. + 2018-11-14 Jeff Law <law@redhat.com> * optabs.c (expand_binop): Pass INT_MODE to operand_subword_force diff --git a/gcc/hash-map.h b/gcc/hash-map.h index 39848289d80..5cee4a400d8 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 |