--- Comment #8 from redi at gcc dot gnu dot org 2010-04-19 09:35 ---
It works fine without -std=c++0x, so is only a regression in code using an
experimental compiler mode which implements an incomplet and incorrekt
standard.
This is not the right place to open defect reports against
--- Comment #9 from redi at gcc dot gnu dot org 2010-04-19 10:03 ---
Also, make_pair's reason for existing is to deduce template arguments. If you
don't want argument deduction why use make_pair?
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43785
--- Comment #10 from navin dot kumar at gmail dot com 2010-04-19 14:53
---
However, what would make_pair have deduced its T1 and T2 to be in this example?
My impression was make_pair(x,y) would have deduced T1=uint32_t and
T2=uint32_t. Therefore, make_pairuint32_t,uint32_t(x,y)
--- Comment #11 from navin dot kumar at gmail dot com 2010-04-19 14:54
---
typo: constructor has not changed in the above post should be function has
not changed
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43785
--- Comment #12 from bangerth at gmail dot com 2010-04-19 14:57 ---
(In reply to comment #9)
Also, make_pair's reason for existing is to deduce template arguments. If you
don't want argument deduction why use make_pair?
True. I don't know why one would want to do this either, but
--- Comment #13 from redi at gcc dot gnu dot org 2010-04-19 15:26 ---
(In reply to comment #10)
However, what would make_pair have deduced its T1 and T2 to be in this
example?
My impression was make_pair(x,y) would have deduced T1=uint32_t and
T2=uint32_t. Therefore,
--- Comment #14 from redi at gcc dot gnu dot org 2010-04-19 15:37 ---
(In reply to comment #13)
Well it's about time someone put a stop to it ;-)
Seriously though, it's quicker to write e.g.
return std::pairuint32_t, uint32_t(x, y)
than
return std::make_pairuint32_t, uint32_t(x,
--- Comment #15 from bangerth at gmail dot com 2010-04-19 15:51 ---
(In reply to comment #14)
Well it's about time someone put a stop to it ;-)
Seriously though, it's quicker to write e.g.
return std::pairuint32_t, uint32_t(x, y)
than
return std::make_pairuint32_t,
--- Comment #16 from redi at gcc dot gnu dot org 2010-04-19 16:13 ---
Understood, but I don't see any way to fix that code. std::make_pair has been
changed to handle rvalues, including deducing whether its arguments are lvalues
or rvalues.
By suppressing the type deduction you also
--- Comment #17 from redi at gcc dot gnu dot org 2010-04-19 16:15 ---
(In reply to comment #16)
templateclass _T1, class _T2
inline pairtypename __decay_and_strip_T1::__type,
typename __decay_and_strip_T2::__type
make_pair(const typename identity_T1::type __x,
--- Comment #18 from paolo dot carlini at oracle dot com 2010-04-20 02:23
---
I largely agree with Jon. Note, at this stage in the standardization process
it's pretty difficult to change the working draft. Agreed, std::pair will be
different wrt the FCD, but if somebody want to change
--- Comment #3 from pinskia at gcc dot gnu dot org 2010-04-19 01:06 ---
With C++0x we have:
templateclass _T1, class _T2
inline pairtypename __decay_and_strip_T1::__type,
typename __decay_and_strip_T2::__type
make_pair(_T1 __x, _T2 __y)
Which is correct that lvalues cannot
--- Comment #4 from paolo dot carlini at oracle dot com 2010-04-19 02:06
---
Andrew, the situation isn't *that* simple as you seem to believe, because
make_pair is *templatized*, thus in general it works perfectly well with
lvalues. For example, this works:
--- Comment #5 from paolo dot carlini at oracle dot com 2010-04-19 02:08
---
Of course by standard I meant the current working draft, the FCD. We are in
the realm of the still *highly* experimental C++0x mode.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43785
--- Comment #6 from paolo dot carlini at oracle dot com 2010-04-19 02:13
---
In any case, Andrew is right (if I understand correctly the gist of his
message), that a conforming implementation of the FCD can *only* fail to
compile the provided snippet *when* the types are explicitely
--- Comment #7 from bangerth at gmail dot com 2010-04-19 02:59 ---
I think the point Andrew wanted to make is that it's a regression
*from the user perspective*. I had a half dozen places in our code
that now no longer compile in c++0x mode. Apparently others do too.
If the standard is
16 matches
Mail list logo