This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/68190] [5/6 Regression] iterator mix up with set::find and heterogenous lookup
- From: "redi at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 03 Nov 2015 14:48:18 +0000
- Subject: [Bug libstdc++/68190] [5/6 Regression] iterator mix up with set::find and heterogenous lookup
- Auto-submitted: auto-generated
- References: <bug-68190-4 at http dot gcc dot gnu dot org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68190
--- Comment #8 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(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.