LLVM Bugzilla is read-only and represents the historical archive of all LLVM issues filled before November 26, 2021. Use github to submit LLVM bugs

Bug 41130 - operator/ of std::chrono::duration and custom type
Summary: operator/ of std::chrono::duration and custom type
Status: RESOLVED FIXED
Alias: None
Product: libc++
Classification: Unclassified
Component: All Bugs (show other bugs)
Version: unspecified
Hardware: All All
: P enhancement
Assignee: Marshall Clow (home)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-03-18 14:28 PDT by llvm-bugs
Modified: 2019-04-01 09:39 PDT (History)
3 users (show)

See Also:
Fixed By Commit(s):


Attachments
code to reproduce (189 bytes, text/x-c++src)
2019-03-18 14:28 PDT, llvm-bugs
Details
patch by Howard Hinnant (655 bytes, patch)
2019-03-18 14:29 PDT, llvm-bugs
Details

Note You need to log in before you can comment on or make changes to this bug.
Description llvm-bugs 2019-03-18 14:28:28 PDT
Created attachment 21624 [details]
code to reproduce

Defining an operator/ with a chrono::duration and a custom type fails to compile with libc++.

Example code attached
Problem description initially on https://stackoverflow.com/q/55167862/620382
Suggested patch by Howard Hinnant https://stackoverflow.com/a/55203313/620382
Comment 1 llvm-bugs 2019-03-18 14:29:04 PDT
Created attachment 21625 [details]
patch by Howard Hinnant
Comment 2 Marshall Clow (home) 2019-03-18 14:38:36 PDT
Nice patch, Howard. Needs more cowbell, though.
In particular, it needs to deal with `operator%`.
Working on it...
Comment 3 Marshall Clow (home) 2019-03-19 08:15:04 PDT
Howard's patch (when applied twice) fixes the problem; except on C++03.
Comment 4 Marshall Clow (home) 2019-03-19 20:36:02 PDT
Multiply has similar problems, too.
Comment 5 Zoe Carver 2019-03-20 08:07:39 PDT
Are there tests for these operators?
Comment 6 Marshall Clow (home) 2019-03-20 09:09:35 PDT
(In reply to Zoe Carver from comment #5)
> Are there tests for these operators?

There are ... some.
I have added more as I investigate this bug.
Comment 7 Marshall Clow (home) 2019-04-01 09:39:25 PDT
Fixed in r357410.