[libcxx-dev] [libcxx-bugs] Incoherent behaviour on integer overflow

Hans Wennborg via libcxx-dev libcxx-dev at lists.llvm.org
Mon Jan 27 09:54:10 PST 2020

+libcxx-dev as I'm not sure how many people read libcxx-bugs.

On Mon, Jan 27, 2020 at 9:37 AM phiippe dunski via libcxx-bugs
<libcxx-bugs at lists.llvm.org> wrote:
> Hello,
> I'm not sure that this mail should really have to be sent on this list, Maybe should I report this to specific clang mailing list. But, I hope you put me on the right way...
> Here is the overflow_error.cpp which contains what I expected to be 16 error case when using std::integral_constant.
> The point was, for me, perfectly clear : for each integer type, if I try to define some constant whose value is  std::numeric_limits<the_type>::min()-1 or std::numeric_limits<the_type>::max() + 1, I should get the same behaviour : at least some compile time warning, or mabe even some compile time error.
> Having two error cases for each data type, and eight data types, I was expecting to get ... sixteen error when trying to compile this file.
> But, as you can see it in the error_output.txt, they are only fourteen errors:
> using std::numeric_limits<uint32_t>::max() +1 and std::numeric_limits<uint64_t>::max() + 1 do not produce the same behaviour than usigne other data types or values.
> IMHO, there is some incoherence behind that.  Isn't it?
> PS: Please forgive my poor English, but my mother tongue is French
> _______________________________________________
> libcxx-bugs mailing list
> libcxx-bugs at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/libcxx-bugs

More information about the libcxx-dev mailing list