[Bug libstdc++/68190] [5/6 Regression] iterator mix up with set::find and heterogenous lookup

2015-11-10 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68190

--- Comment #11 from Jonathan Wakely  ---
Author: redi
Date: Tue Nov 10 15:12:24 2015
New Revision: 230113

URL: https://gcc.gnu.org/viewcvs?rev=230113=gcc=rev
Log:
Fix return type of heterogeneous find for sets

PR libstdc++/68190
* include/bits/stl_multiset.h (multiset::find): Fix return types.
* include/bits/stl_set.h (set::find): Likewise.
* testsuite/23_containers/map/operations/2.cc: Test find return types.
* testsuite/23_containers/multimap/operations/2.cc: Likewise.
* testsuite/23_containers/multiset/operations/2.cc: Likewise.
* testsuite/23_containers/set/operations/2.cc: Likewise.

Modified:
trunk/libstdc++-v3/ChangeLog
trunk/libstdc++-v3/include/bits/stl_multiset.h
trunk/libstdc++-v3/include/bits/stl_set.h
trunk/libstdc++-v3/testsuite/23_containers/map/operations/2.cc
trunk/libstdc++-v3/testsuite/23_containers/multimap/operations/2.cc
trunk/libstdc++-v3/testsuite/23_containers/multiset/operations/2.cc
trunk/libstdc++-v3/testsuite/23_containers/set/operations/2.cc

[Bug libstdc++/68190] [5/6 Regression] iterator mix up with set::find and heterogenous lookup

2015-11-10 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68190

--- Comment #12 from Jonathan Wakely  ---
Author: redi
Date: Tue Nov 10 18:08:50 2015
New Revision: 230118

URL: https://gcc.gnu.org/viewcvs?rev=230118=gcc=rev
Log:
Fix return type of heterogeneous find for sets

PR libstdc++/68190
* include/bits/stl_multiset.h (multiset::find): Fix return types.
* include/bits/stl_set.h (set::find): Likewise.
* testsuite/23_containers/map/operations/2.cc: Test find return types.
* testsuite/23_containers/multimap/operations/2.cc: Likewise.
* testsuite/23_containers/multiset/operations/2.cc: Likewise.
* testsuite/23_containers/set/operations/2.cc: Likewise.

Modified:
branches/gcc-5-branch/libstdc++-v3/ChangeLog
branches/gcc-5-branch/libstdc++-v3/include/bits/stl_multiset.h
branches/gcc-5-branch/libstdc++-v3/include/bits/stl_set.h
   
branches/gcc-5-branch/libstdc++-v3/testsuite/23_containers/map/operations/2.cc
   
branches/gcc-5-branch/libstdc++-v3/testsuite/23_containers/multimap/operations/2.cc
   
branches/gcc-5-branch/libstdc++-v3/testsuite/23_containers/multiset/operations/2.cc
   
branches/gcc-5-branch/libstdc++-v3/testsuite/23_containers/set/operations/2.cc

[Bug libstdc++/68190] [5/6 Regression] iterator mix up with set::find and heterogenous lookup

2015-11-10 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68190

Jonathan Wakely  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED
   Target Milestone|--- |5.3

--- Comment #13 from Jonathan Wakely  ---
Fixed.

[Bug libstdc++/68190] [5/6 Regression] iterator mix up with set::find and heterogenous lookup

2015-11-03 Thread trippels at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68190

Markus Trippelsdorf  changed:

   What|Removed |Added

 CC||redi at gcc dot gnu.org
Summary|iterator mix up with|[5/6 Regression] iterator
   |set::find and heterogenous  |mix up with set::find and
   |lookup  |heterogenous lookup

--- Comment #7 from Markus Trippelsdorf  ---
I'll let Jonathan handle this, when he comes back from traveling.

[Bug libstdc++/68190] [5/6 Regression] iterator mix up with set::find and heterogenous lookup

2015-11-03 Thread howard.hinnant at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68190

--- Comment #9 from Howard Hinnant  ---
Untested fix suggested:

#if __cplusplus > 201103L   
  template
auto
find(const _Kt& __x) -> decltype(iterator{_M_t._M_find_tr(__x)})
{ return iterator{_M_t._M_find_tr(__x)}; }  

  template
auto
find(const _Kt& __x) const ->
decltype(const_iterator{_M_t._M_find_tr(__x)})  
{ return const_iterator{_M_t._M_find_tr(__x)}; }
#endif

[Bug libstdc++/68190] [5/6 Regression] iterator mix up with set::find and heterogenous lookup

2015-11-03 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68190

--- Comment #10 from Jonathan Wakely  ---
Howard's suggestion is approved if someone tests it, I only have my phone and
no machine I can build or test on.

[Bug libstdc++/68190] [5/6 Regression] iterator mix up with set::find and heterogenous lookup

2015-11-03 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68190

--- Comment #8 from Jonathan Wakely  ---
(In reply to Nik Bougalis from comment #6)
> I don't follow why an auto return is used, instead of simply
> iterator/const_iterator which is the required return value per the
> documentation I've read.

Because doing that would make the functions declared unconditionally, which
would violate the standard. Using decltype means we get the SFINAE constraint
on the _M_find_tr function and so the overload is disabled when the comparison
function is not transparent, as required by the standard.

But it could be decltype(_M_t._M_find_tr(__x), iterator{}) which would still
check the constraint, and also return the correct type.

I can't test that until I'm home though.