On Thu, 14 May 2026 at 09:04, Tomasz Kaminski <[email protected]> wrote:
>
>
>
> On Wed, May 13, 2026 at 10:01 PM Jonathan Wakely <[email protected]> wrote:
>>
>> libstdc++-v3/ChangeLog:
>>
>>         * testsuite/std/time/clock/utc/leap_second_info-2.cc: Fix sign
>>         compare warning. Tweak comment.
>> ---
>>
>> Tested x86_64-linux. Pushed to trunk.
>>
>>  .../testsuite/std/time/clock/utc/leap_second_info-2.cc        | 4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/libstdc++-v3/testsuite/std/time/clock/utc/leap_second_info-2.cc 
>> b/libstdc++-v3/testsuite/std/time/clock/utc/leap_second_info-2.cc
>> index 090a28291c85..59634b34944f 100644
>> --- a/libstdc++-v3/testsuite/std/time/clock/utc/leap_second_info-2.cc
>> +++ b/libstdc++-v3/testsuite/std/time/clock/utc/leap_second_info-2.cc
>> @@ -52,7 +52,7 @@ test_future_leaps()
>>    std::ofstream("leapseconds") << "";
>>
>>    using std::chrono::years;
>> -  auto s = std::chrono::utc_seconds(1483228826s + years(100)); // 1 Jan 2117
>> +  auto s = std::chrono::utc_seconds(1483228826s + years(100)); // 2117
>>    auto lsi = get_leap_second_info(s);
>>    VERIFY( override_used ); // If this fails then XFAIL for the target.
>>    VERIFY( lsi.is_leap_second == false );
>> @@ -91,7 +91,7 @@ Leap  2120    Dec     30      23:59:59        -       S
>>    // The file was not read again:
>>    VERIFY( ! override_used );
>>    // The list in the tzdb contains the three fake leap seconds:
>> -  VERIFY( tzdb.leap_seconds.size() == hardcoded_count.count() + 3 );
>> +  VERIFY( tzdb.leap_seconds.size() == size_t(hardcoded_count.count() + 3) );
>
> I would preffer +3u, but it is fine as is.

I would prefer that too, but chrono::seconds::rep is int64_t and when
you add 3u to that you still get int64_t, which is still signed and so
still gives a warning when compared to size_t.

3ull would work.

>>
>>    // And repeating the queries above gives the same results:
>>    lsi = get_leap_second_info(s);
>>    VERIFY( lsi.is_leap_second == false );
>> --
>> 2.54.0
>>

Reply via email to