https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85821

--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> ---
As explained above, and in LWG 2383, the standard signatures are flawed and
cannot meet the requirements of the standard to make 9223372036854775808s
ill-formed. Libstdc++ makes that ill-formed, as required by the standard:

/usr/include/c++/15/bits/chrono.h:1371:32: error: static assertion failed:
literal value cannot be represented by duration type
 1371 |         static_assert(__repval >= 0 && __repval == _Val::value,
      |                       ~~~~~~~~~^~~~

Libc++ implements operator""s(unsigned long long) as specified in the standard,
and fails to diagnose the overflow.

Implementing the overflow check in the lirbary is impossible with a change to
the language (e.g. making a user-defined-literal such as 123s be constant
evaluated).

So IWYU needs to cope with how these are defined.

Reply via email to