[libcxx-commits] [PATCH] D59659: Direction for a fix of PR 41130

Marshall Clow via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Thu Mar 21 11:35:53 PDT 2019


mclow.lists created this revision.
mclow.lists added reviewers: EricWF, ldionne, howard.hinnant.
mclow.lists added a project: libc++.
Herald added a subscriber: christof.

https://llvm.org/PR41130

This is NOT a final patch.
I'm looking for suggestions on how to improve it.
But .. it does solve the OP's problem, and introduces no new ones that I can find.

Changes that have to be made before this is landed:

- Naming; we obviously don't want `__Fooby`, `__Fooby2`, etc in our code base.
- Removing the old `__duration_divide_result` and `__duration_divide_result_imp` classes which are no longer used
- Looking at `operator *` which probably needs the same treatment.
- Do we want to grab `__has_common_type` and put it in `<type_traits>` where other parts of libc++ can use it?

The reason that this is so pernicious is that `common_type` will blow up on you in C++03, rather than just SFINAE-ing away.  So, you'd better be sure that there is a common type before you ask.

Note that the approach in this patch fails for C++03 (for the cases in the bug report). I don't know how to fix that. But, this patch does NOT break any existing cases in C++03 (Which Howard's 'lightly tested" patch did).


https://reviews.llvm.org/D59659

Files:
  libcxx/include/chrono
  libcxx/test/std/utilities/time/rep.h
  libcxx/test/std/utilities/time/time.duration/time.duration.arithmetic/op_divide=.pass.cpp
  libcxx/test/std/utilities/time/time.duration/time.duration.arithmetic/op_mod=duration.pass.cpp
  libcxx/test/std/utilities/time/time.duration/time.duration.arithmetic/op_mod=rep.pass.cpp
  libcxx/test/std/utilities/time/time.duration/time.duration.arithmetic/op_times=.pass.cpp
  libcxx/test/std/utilities/time/time.duration/time.duration.nonmember/op_divide_rep.pass.cpp
  libcxx/test/std/utilities/time/time.duration/time.duration.nonmember/op_mod_rep.pass.cpp
  libcxx/test/std/utilities/time/time.duration/time.duration.nonmember/op_times_rep.pass.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D59659.191750.patch
Type: text/x-patch
Size: 10300 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20190321/6811895d/attachment-0001.bin>


More information about the libcxx-commits mailing list