[PATCH] libstdc++: Members missing in std::numeric_limits<integer-class type>

Jonathan Wakely jwakely@redhat.com
Wed Jul 9 11:16:48 GMT 2025


On Fri, 4 Jul 2025 at 13:11, Mateusz Zych <mte.zych@gmail.com> wrote:
>
> Hello!
>
> I've updated the ChangeLog, since I forgot to do it before.

Thanks, I've pushed the patch to trunk now.  I used a simpler commit
message, without the large verbatim quotes from the standard.

Thanks again for noticing the problem and contributing the fix.


>
> Thanks, Mateusz Zych
>
> On Thu, Jul 3, 2025 at 9:49 PM Mateusz Zych <mte.zych@gmail.com> wrote:
>>
>> Hello!
>>
>> I've prepared a patch, which adds all members missing from
>> std::numeric_limits<> specializations for integer-class types.
>>
>> Jonathan, please let me know whether you like these changes
>> and do not see any bugs or issues with them. From my side, I just want to say that:
>>
>> Since all std::numeric_limits<> specializations for integral types,
>> defined in //libstdc++-v3/include/std/limits don't inherit from a base class
>> providing common data members and member functions,
>> I also didn't introduce such a base class in //libstdc++-v3/include/bits/max_size_type.h.
>> Such implementation has quite a bit of code duplication, but it's like that on purpose, right?
>>
>> I didn't test the traps static data member, because I don't know how to
>> accurately predict when this compile-time constant should be true and when it should be false.
>> Moreover, I saw that the unit-test verifying correctness of the traps constant
>> from std::numeric_limits<> specializations for integral types
>> (//libstdc++-v3/testsuite/18_support/numeric_limits/traps.cc) also doesn't verify its value.
>>
>> In the unit-tests for integer-class types I've defined variable template
>> verify_numeric_limits_values_not_meaningful_for<> to avoid code duplication
>> and have clear and readable code. I hope this is OK.
>>
>> Thanks, Mateusz Zych
>>
>> On Wed, Jul 2, 2025 at 7:30 PM Jonathan Wakely <jwakely@redhat.com> wrote:
>>>
>>> On Wed, 2 Jul 2025 at 17:15, Mateusz Zych wrote:
>>> >
>>> > OK, then I’ll prepare appropriate patch with tests and send it when I’m done implementing it.
>>>
>>> That would be great, thanks. I won't push the initial patch, we can
>>> wait for you to prepare the complete fix.
>>>
>>> Please note that for a more significant change, we have some legal
>>> prerequisites for contributions, as documented at:
>>> https://gcc.gnu.org/contribute.html#legal
>>>
>>> If you want to contribute under the DCO terms, please read
>>> https://gcc.gnu.org/dco.html so that you understand exactly what the
>>> Signed-off-by: trailer means.
>>>
>>> Thanks!
>>>



More information about the Libstdc++ mailing list