This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]