[libcxx-dev] Potential bug in use of auto in comparator lambda for std::upper_bound when debug build is enabled
Wesley Yue via libcxx-dev
libcxx-dev at lists.llvm.org
Thu Apr 25 10:49:57 PDT 2019
That's correct. I was using the 7.0.0 release. Good to know it's fixed in 8.0. Thanks for investigating!
From: Eric Fiselier <eric at efcs.ca>
Sent: Thursday, April 25, 2019 3:22 AM
To: Marshall Clow
Cc: Wesley Yue; libcxx-dev at lists.llvm.org
Subject: Re: [libcxx-dev] Potential bug in use of auto in comparator lambda for std::upper_bound when debug build is enabled
The code referenced in the diagnostics appears in 7.0 but not 8.0.
At some point the debug implementation was removed from upper and lower bound,
but I can't find the exact commit that removed it.
Either way this should be fixed now.
On Wed, Apr 24, 2019 at 8:41 AM Marshall Clow via libcxx-dev <libcxx-dev at lists.llvm.org<mailto:libcxx-dev at lists.llvm.org>> wrote:
On Wed, Apr 24, 2019 at 9:15 AM Wesley Yue via libcxx-dev <libcxx-dev at lists.llvm.org<mailto: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?
libcxx-dev mailing list
libcxx-dev at lists.llvm.org<mailto:libcxx-dev at lists.llvm.org>
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the libcxx-dev