microsoft / microsoft/STL

`<chrono>`: Need more robust handling of custom arithmetic types

Open
#1,909 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug chrono
Dominant language
C++
Stars
11.2k
Forks
1.7k
Avg merge
4d 15h
Merged PRs (30d)
22

Description

Observed by @statementreply.

In general, we currently do not robustly handle custom arithmetic-like types. Note that we expect this use case to be very uncommon, so this is not a high-priority bug.

Until this is completely addressed, we should make sure to at least fail cleanly if custom arithmetic-like types are used. As an example, we currently use _STD nextafter on a duration::rep that could potentially be a custom arithmetic-like type, in which case it would fail cleanly.

https://github.com/microsoft/STL/blob/65eb5077778a11cc4abac88b5fd5d0a25a2dcd19/stl/inc/chrono#L3243-L3246

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with stl/inc/chrono around lines 3243-3246 and read the linked discussion in microsoft/STL#1671. Determine how custom arithmetic-like duration::rep types should fail cleanly when passed to _STD nextafter, then verify the behavior against relevant chrono coverage.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.