[libcxx-dev] Potential bug in use of auto in comparator lambda for std::upper_bound when debug build is enabled

Marshall Clow via libcxx-dev libcxx-dev at lists.llvm.org
Wed Apr 24 08:41:41 PDT 2019


On Wed, Apr 24, 2019 at 9:15 AM Wesley Yue via libcxx-dev <
libcxx-dev at lists.llvm.org> wrote:

> I'm working on some code that compares two different types with
> std::upper_bound and does so with a custom lambda, which takes both
> parameters as type "auto". When building normally, this compiles fine. When
> building with -D_LIBCPP_DEBUG=1, this fails and somewhere in the template
> magic, libc++ seems to confuse the two types and pass them into the lambda
> backwards.
>
> Here is some minimal code to reproduce, and the corresponding compilation
> error:
>

I just tried this with libc++ trunk, and didn't get a compile error.
(I got a link error, but that's because I wasn't linking against a debug
dylib)

What version of libc++ are you using?

-- Marshall
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/libcxx-dev/attachments/20190424/5cfcfe83/attachment.html>


More information about the libcxx-dev mailing list