On Tue, 27 May 2025 at 07:51, Luc Grosheintz <luc.groshei...@gmail.com> wrote:
>
> While reading the compiler output of
>
>     make check-target-libstdc++-v3
>
> for buggy code, e.g. cmp_equal(1.0, 1.0), the error message
> was very short, and I saw no hint that neither of the two
> template arguments weren't integers. Essentially, the trace
> was:
>
>   1. my faulty line
>   2. required from here
>   3. static_assert(false)
>
> On regular builds with g++ the error message mentions the
> static_assert(__is_standard_integer), and is much less
> cryptic. Please ignore if this is intended behaviour.

That's because the testsuite runs with -fdiagnostics-plain-output
which is certainly the intended behaviour. That's useful for
machine-readable output (as needed by the testsuite so that additional
diagnostic notes don't confuse the testsuite) but isn't intended to be
used for human-readable output.

As long as the diagnostic is fine for normal I don't think we need to
optimize the code for the purposes of the testsuite. And since GCC
doesn't support any extended integer types, I'm not really concerned
about that misinterpretation of the __is_standard_integer trait. Maybe
it would make sense to rename that to __is_signed_or_unsigned_integer
though. We do already have __cv_unqual_signed_or_unsigned_integer_type
in <stdckdint.h>.




>
> Tested on x86_64 with:
>
>     make check-target-libstdc++-v3
>
> (in a no PCH build).
>
> Luc Grosheintz (1):
>   libstdc++: Improve diagnostic message for `cmp_*` and `in_range`.
>
>  libstdc++-v3/include/std/utility | 18 ++++++++++++------
>  1 file changed, 12 insertions(+), 6 deletions(-)
>
> --
> 2.49.0
>

Reply via email to