summaryrefslogtreecommitdiffstats
path: root/libcxx/test/std/utilities/time/time.duration/time.duration.arithmetic/op_mod=rep.pass.cpp
diff options
context:
space:
mode:
authorMarshall Clow <mclow.lists@gmail.com>2019-04-01 16:38:02 +0000
committerMarshall Clow <mclow.lists@gmail.com>2019-04-01 16:38:02 +0000
commitefa6d803c624f9251d0ab7881122501bb9d27368 (patch)
treeb00dad7fc97cd2c6a2e2c92cd1d87c5c738acd88 /libcxx/test/std/utilities/time/time.duration/time.duration.arithmetic/op_mod=rep.pass.cpp
parent2a67c910764b6c20f6d146797b354dfb0028bd52 (diff)
downloadbcm5719-llvm-efa6d803c624f9251d0ab7881122501bb9d27368.tar.gz
bcm5719-llvm-efa6d803c624f9251d0ab7881122501bb9d27368.zip
Fix PR41130 - 'operator/ of std::chrono::duration and custom type'. Thanks to Zulan for the report, and Howard for the direction of the fix.
llvm-svn: 357410
Diffstat (limited to 'libcxx/test/std/utilities/time/time.duration/time.duration.arithmetic/op_mod=rep.pass.cpp')
-rw-r--r--libcxx/test/std/utilities/time/time.duration/time.duration.arithmetic/op_mod=rep.pass.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/libcxx/test/std/utilities/time/time.duration/time.duration.arithmetic/op_mod=rep.pass.cpp b/libcxx/test/std/utilities/time/time.duration/time.duration.arithmetic/op_mod=rep.pass.cpp
index 0eb73ee674f..f5ef512381a 100644
--- a/libcxx/test/std/utilities/time/time.duration/time.duration.arithmetic/op_mod=rep.pass.cpp
+++ b/libcxx/test/std/utilities/time/time.duration/time.duration.arithmetic/op_mod=rep.pass.cpp
@@ -17,6 +17,11 @@
#include "test_macros.h"
+class NotARep {};
+
+typedef std::chrono::seconds Duration;
+Duration operator%=(Duration d, NotARep) { return d; }
+
#if TEST_STD_VER > 14
constexpr bool test_constexpr()
{
@@ -38,5 +43,15 @@ int main(int, char**)
static_assert(test_constexpr(), "");
#endif
+#if TEST_STD_VER >= 11
+ { // This is PR#41130
+ Duration d(5);
+ NotARep n;
+ d %= n;
+ assert(d.count() == 5);
+ }
+#endif
+
+
return 0;
}
OpenPOWER on IntegriCloud