On Wed, 14 Nov 2018, Richard Biener wrote:
On Wed, 14 Nov 2018, Jakub Jelinek wrote:
Hi!
As mentioned in the PR, with GCC before 4.3 one can't instantiate std::pair
where one or both of the template parameters are reference types, because
the std::pair constructor has arguments references to the template parameter
types and the CWG that resolved hasn't been applied to those compilers.
The following patch works around it by not returning
std::pair<const Key &, Value &> object, but instead a different class that
holds the two references and has conversion operator to std::pair.
If that conversion operator isn't acceptable, in the PR there is another
patch which adjusts the (so far) two spots which need to be changed in that
case.
Bootstrapped/regtested on x86_64-linux and i686-linux (using GCC 7 as
bootstrap compiler) and tested on the preprocessed source with GCC 4.1.
Ok for trunk?
Works for me if C++ people have no better idea.
A number of C++ people actually dislike std::pair on general principle and
believe that we should instead use classes with meaningful field names
(key and value?). Of course, that's way more disruptive and thus probably
less desirable here.
--
Marc Glisse