[cfe-dev] [libc++] Should std::max allow types that require explicit bool conversion?

Jö Fahlke via cfe-dev cfe-dev at lists.llvm.org
Fri Jul 6 02:58:42 PDT 2018

Am Do,  5. Jul 2018, 20:23:23 +0200 schrieb Jö Fahlke via cfe-dev:
> I was surprised to find that I cannot use libc++'s `std::max(a, b)` if `a<b`
> yields an object with an explicit operator bool.  Is that intended, or should
> I file a bug?

To answer my own question: apparently this is due to the still open issue 2114
<https://cplusplus.github.io/LWG/issue2114> in the standard.  The proposed
resolution is to require `a<b` to be _both_ contextually and and implicitly
convertible to bool, plus a few other things related to short-circuiting.


Jorrit (Jö) Fahlke, Institute for Computational und Applied Mathematics,
University of Münster, Orleans-Ring 10, D-48149 Münster
Tel: +49 251 83 35146 Fax: +49 251 83 32729

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20180706/fd7f0a9d/attachment.sig>

More information about the cfe-dev mailing list