[all-commits] [llvm/llvm-project] 6c97ad: [libc++][chrono] Fix streaming for unsigned durati...

Mark de Wever via All-commits all-commits at lists.llvm.org
Wed Jul 10 11:13:26 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 6c97ad4e6838a1172d957df83ec60af646ccacc0
      https://github.com/llvm/llvm-project/commit/6c97ad4e6838a1172d957df83ec60af646ccacc0
  Author: Mark de Wever <koraq at xs4all.nl>
  Date:   2024-07-10 (Wed, 10 Jul 2024)

  Changed paths:
    M libcxx/include/__chrono/formatter.h
    M libcxx/test/std/time/time.duration/time.duration.nonmember/ostream.pass.cpp
    M libcxx/test/std/time/time.syn/formatter.duration.pass.cpp

  Log Message:
  -----------
  [libc++][chrono] Fix streaming for unsigned durations. (#97889)

This fixes formatting for durations using the unsigned types unsigned
short, unsigned, unsigned long, and unsigned long long. It does not
allow the unsigned char type. Since the formatting function uses
ostream::operator<< this type probably does not do what it should do.

Note that based on the standard all arithmetic types are allowed,
including bool, char, wchar_t. These types are not implemented either.
Allowing them seems like a defect in the Standard.

No effort is done to support user-defined types; the wording in the
Standard is unclear regarding the constrains for these types.

[LWG 4118](https://cplusplus.github.io/LWG/issue4118) discusses this
issue further.

Fixes https://github.com/llvm/llvm-project/issues/96820



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list