Since 97d6161f6a7fa712 / r11-7370 "libstdc++: More efficient
days from date" I see an additional 81 testsuite-errors for
cris-elf, with this in g++.log for one randomly picked
regressing test:

FAIL: g++.dg/cpp1y/pr57640.C  -std=c++2a (test for excess errors)
Excess errors:
/x/gccobj/cris-elf/libstdc++-v3/include/chrono:2483:25: error: invalid 
'static_cast' from type 'const std::chrono::month' to type 'uint32_t' {aka 
'long unsigned int'}
/x/gccobj/cris-elf/libstdc++-v3/include/chrono:2484:25: error: invalid 
'static_cast' from type 'const std::chrono::day' to type 'uint32_t' {aka 'long 
unsigned int'}
/x/gccobj/cris-elf/libstdc++-v3/include/chrono:2496:69: error: no matching 
function for call to 'std::chrono::duration<long long int, std::ratio<86400> 
>::duration(<brace-enclosed initializer list>)'

The commit shows conversions to uint32_t, which for
e.g. x86_64-linux is "unsigned int", and there are explicit
conversions to unsigned int for month and day (see patch
context).

But, "newlib ILP32 targets" have an uint32_t that is
effectively typedef'd "long unsigned int" (see
newlib-stdint.h UINT32_TYPE).

Better provide an unsigned long conversion aside the
unsigned ones.

Tested cris-elf.  Pending x86_64-linux regtest results, ok?

libstdc++-v3:
        PR libstdc++/99301
        * include/std/chrono (day, month): Provide
        conversion to unsigned long.
---
 libstdc++-v3/include/std/chrono | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/libstdc++-v3/include/std/chrono b/libstdc++-v3/include/std/chrono
index fcdaee7328ed..33fb0860b41a 100644
--- a/libstdc++-v3/include/std/chrono
+++ b/libstdc++-v3/include/std/chrono
@@ -1334,6 +1334,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       operator unsigned() const noexcept
       { return _M_d; }
 
+      constexpr explicit
+      operator unsigned long() const noexcept
+      { return _M_d; }
+
       constexpr bool
       ok() const noexcept
       { return 1 <= _M_d && _M_d <= 31; }
@@ -1443,6 +1447,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       operator unsigned() const noexcept
       { return _M_m; }
 
+      explicit constexpr
+      operator unsigned long() const noexcept
+      { return _M_m; }
+
       constexpr bool
       ok() const noexcept
       { return 1 <= _M_m && _M_m <= 12; }
-- 
2.11.0

Reply via email to