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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |4.8.0
             Status|WAITING                     |RESOLVED
         Resolution|---                         |FIXED

--- Comment #45 from Jonathan Wakely <redi at gcc dot gnu.org> ---
https://cplusplus.github.io/LWG/issue2422 changed the spec for is_modulo to
remove the "on most machines" text and add:

  -??- [Example: is_modulo is false for signed integer types
([basic.fundamental])
  unless an implementation, as an extension to this International Standard,
defines signed
  integer overflow to wrap. — end example]

This seems very clear that numeric_limits<int>::is_modulo should be false
*unless* -fwrapv is used. I'm going to close this now. If GCC gets a macro that
allows us to detect the presence of -fwrapv we can revisit it.

N.B. Since C++17 is_modulo is an inline variable and so no extern definition in
libstdc++.so is needed. If we made it depend on -fwrapv then you would still
get ODR violations between different translation units compiled with different
-fwrapv states, but at least you wouldn't get a value from libstdc++.so that
ignores the current TU.

Reply via email to