mirror of
https://github.com/darlinghq/darling-libcxx.git
synced 2024-11-27 13:50:23 +00:00
Implement P0505: 'Wording for GB 50'
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@291028 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
9c6b70a0af
commit
3df90c94a3
@ -77,13 +77,13 @@ public:
|
||||
|
||||
constexpr duration operator+() const;
|
||||
constexpr duration operator-() const;
|
||||
duration& operator++();
|
||||
duration operator++(int);
|
||||
duration& operator--();
|
||||
duration operator--(int);
|
||||
constexpr duration& operator++();
|
||||
constexpr duration operator++(int);
|
||||
constexpr duration& operator--();
|
||||
constexpr duration operator--(int);
|
||||
|
||||
duration& operator+=(const duration& d);
|
||||
duration& operator-=(const duration& d);
|
||||
constexpr duration& operator+=(const duration& d);
|
||||
constexpr duration& operator-=(const duration& d);
|
||||
|
||||
duration& operator*=(const rep& rhs);
|
||||
duration& operator/=(const rep& rhs);
|
||||
@ -567,18 +567,18 @@ public:
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR duration operator+() const {return *this;}
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR duration operator-() const {return duration(-__rep_);}
|
||||
_LIBCPP_INLINE_VISIBILITY duration& operator++() {++__rep_; return *this;}
|
||||
_LIBCPP_INLINE_VISIBILITY duration operator++(int) {return duration(__rep_++);}
|
||||
_LIBCPP_INLINE_VISIBILITY duration& operator--() {--__rep_; return *this;}
|
||||
_LIBCPP_INLINE_VISIBILITY duration operator--(int) {return duration(__rep_--);}
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 duration& operator++() {++__rep_; return *this;}
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 duration operator++(int) {return duration(__rep_++);}
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 duration& operator--() {--__rep_; return *this;}
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 duration operator--(int) {return duration(__rep_--);}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY duration& operator+=(const duration& __d) {__rep_ += __d.count(); return *this;}
|
||||
_LIBCPP_INLINE_VISIBILITY duration& operator-=(const duration& __d) {__rep_ -= __d.count(); return *this;}
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 duration& operator+=(const duration& __d) {__rep_ += __d.count(); return *this;}
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 duration& operator-=(const duration& __d) {__rep_ -= __d.count(); return *this;}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY duration& operator*=(const rep& rhs) {__rep_ *= rhs; return *this;}
|
||||
_LIBCPP_INLINE_VISIBILITY duration& operator/=(const rep& rhs) {__rep_ /= rhs; return *this;}
|
||||
_LIBCPP_INLINE_VISIBILITY duration& operator%=(const rep& rhs) {__rep_ %= rhs; return *this;}
|
||||
_LIBCPP_INLINE_VISIBILITY duration& operator%=(const duration& rhs) {__rep_ %= rhs.count(); return *this;}
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 duration& operator*=(const rep& rhs) {__rep_ *= rhs; return *this;}
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 duration& operator/=(const rep& rhs) {__rep_ /= rhs; return *this;}
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 duration& operator%=(const rep& rhs) {__rep_ %= rhs; return *this;}
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 duration& operator%=(const duration& rhs) {__rep_ %= rhs.count(); return *this;}
|
||||
|
||||
// special values
|
||||
|
||||
|
@ -11,15 +11,31 @@
|
||||
|
||||
// duration
|
||||
|
||||
// duration& operator++();
|
||||
// constexpr duration& operator++(); // constexpr in c++17
|
||||
|
||||
#include <chrono>
|
||||
#include <cassert>
|
||||
|
||||
#include "test_macros.h"
|
||||
|
||||
#if TEST_STD_VER > 14
|
||||
constexpr bool test_constexpr()
|
||||
{
|
||||
std::chrono::hours h(3);
|
||||
return (++h).count() == 4;
|
||||
}
|
||||
#endif
|
||||
|
||||
int main()
|
||||
{
|
||||
{
|
||||
std::chrono::hours h(3);
|
||||
std::chrono::hours& href = ++h;
|
||||
assert(&href == &h);
|
||||
assert(h.count() == 4);
|
||||
}
|
||||
|
||||
#if TEST_STD_VER > 14
|
||||
static_assert(test_constexpr(), "");
|
||||
#endif
|
||||
}
|
||||
|
@ -11,15 +11,32 @@
|
||||
|
||||
// duration
|
||||
|
||||
// duration operator++(int);
|
||||
// constexpr duration operator++(int); // constexpr in c++17
|
||||
|
||||
#include <chrono>
|
||||
#include <cassert>
|
||||
|
||||
#include "test_macros.h"
|
||||
|
||||
#if TEST_STD_VER > 14
|
||||
constexpr bool test_constexpr()
|
||||
{
|
||||
std::chrono::hours h1(3);
|
||||
std::chrono::hours h2 = h1++;
|
||||
return h1.count() == 4 && h2.count() == 3;
|
||||
}
|
||||
#endif
|
||||
|
||||
int main()
|
||||
{
|
||||
std::chrono::hours h(3);
|
||||
std::chrono::hours h2 = h++;
|
||||
assert(h.count() == 4);
|
||||
{
|
||||
std::chrono::hours h1(3);
|
||||
std::chrono::hours h2 = h1++;
|
||||
assert(h1.count() == 4);
|
||||
assert(h2.count() == 3);
|
||||
}
|
||||
|
||||
#if TEST_STD_VER > 14
|
||||
static_assert(test_constexpr(), "");
|
||||
#endif
|
||||
}
|
||||
|
@ -11,16 +11,35 @@
|
||||
|
||||
// duration
|
||||
|
||||
// duration& operator+=(const duration& d);
|
||||
// constexpr duration& operator+=(const duration& d); // constexpr in c++17
|
||||
|
||||
#include <chrono>
|
||||
#include <cassert>
|
||||
|
||||
#include "test_macros.h"
|
||||
|
||||
#if TEST_STD_VER > 14
|
||||
constexpr bool test_constexpr()
|
||||
{
|
||||
std::chrono::seconds s(3);
|
||||
s += std::chrono::seconds(2);
|
||||
if (s.count() != 5) return false;
|
||||
s += std::chrono::minutes(2);
|
||||
return s.count() == 125;
|
||||
}
|
||||
#endif
|
||||
|
||||
int main()
|
||||
{
|
||||
{
|
||||
std::chrono::seconds s(3);
|
||||
s += std::chrono::seconds(2);
|
||||
assert(s.count() == 5);
|
||||
s += std::chrono::minutes(2);
|
||||
assert(s.count() == 125);
|
||||
}
|
||||
|
||||
#if TEST_STD_VER > 14
|
||||
static_assert(test_constexpr(), "");
|
||||
#endif
|
||||
}
|
||||
|
@ -11,15 +11,31 @@
|
||||
|
||||
// duration
|
||||
|
||||
// duration& operator--();
|
||||
// constexpr duration& operator--(); // constexpr in C++17
|
||||
|
||||
#include <chrono>
|
||||
#include <cassert>
|
||||
|
||||
#include "test_macros.h"
|
||||
|
||||
#if TEST_STD_VER > 14
|
||||
constexpr bool test_constexpr()
|
||||
{
|
||||
std::chrono::hours h(3);
|
||||
return (--h).count() == 2;
|
||||
}
|
||||
#endif
|
||||
|
||||
int main()
|
||||
{
|
||||
{
|
||||
std::chrono::hours h(3);
|
||||
std::chrono::hours& href = --h;
|
||||
assert(&href == &h);
|
||||
assert(h.count() == 2);
|
||||
}
|
||||
|
||||
#if TEST_STD_VER > 14
|
||||
static_assert(test_constexpr(), "");
|
||||
#endif
|
||||
}
|
||||
|
@ -11,15 +11,33 @@
|
||||
|
||||
// duration
|
||||
|
||||
// duration operator--(int);
|
||||
// constexpr duration operator--(int); // constexpr in C++17
|
||||
|
||||
#include <chrono>
|
||||
#include <cassert>
|
||||
|
||||
#include "test_macros.h"
|
||||
|
||||
#if TEST_STD_VER > 14
|
||||
constexpr bool test_constexpr()
|
||||
{
|
||||
std::chrono::hours h1(3);
|
||||
std::chrono::hours h2 = h1--;
|
||||
return h1.count() == 2 && h2.count() == 3;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
int main()
|
||||
{
|
||||
std::chrono::hours h(3);
|
||||
std::chrono::hours h2 = h--;
|
||||
assert(h.count() == 2);
|
||||
{
|
||||
std::chrono::hours h1(3);
|
||||
std::chrono::hours h2 = h1--;
|
||||
assert(h1.count() == 2);
|
||||
assert(h2.count() == 3);
|
||||
}
|
||||
|
||||
#if TEST_STD_VER > 14
|
||||
static_assert(test_constexpr(), "");
|
||||
#endif
|
||||
}
|
||||
|
@ -16,11 +16,30 @@
|
||||
#include <chrono>
|
||||
#include <cassert>
|
||||
|
||||
#include "test_macros.h"
|
||||
|
||||
#if TEST_STD_VER > 14
|
||||
constexpr bool test_constexpr()
|
||||
{
|
||||
std::chrono::seconds s(3);
|
||||
s -= std::chrono::seconds(2);
|
||||
if (s.count() != 1) return false;
|
||||
s -= std::chrono::minutes(2);
|
||||
return s.count() == -119;
|
||||
}
|
||||
#endif
|
||||
|
||||
int main()
|
||||
{
|
||||
{
|
||||
std::chrono::seconds s(3);
|
||||
s -= std::chrono::seconds(2);
|
||||
assert(s.count() == 1);
|
||||
s -= std::chrono::minutes(2);
|
||||
assert(s.count() == -119);
|
||||
}
|
||||
|
||||
#if TEST_STD_VER > 14
|
||||
static_assert(test_constexpr(), "");
|
||||
#endif
|
||||
}
|
||||
|
@ -16,9 +16,26 @@
|
||||
#include <chrono>
|
||||
#include <cassert>
|
||||
|
||||
#include "test_macros.h"
|
||||
|
||||
#if TEST_STD_VER > 14
|
||||
constexpr bool test_constexpr()
|
||||
{
|
||||
std::chrono::seconds s(15);
|
||||
s /= 5;
|
||||
return s.count() == 3;
|
||||
}
|
||||
#endif
|
||||
|
||||
int main()
|
||||
{
|
||||
{
|
||||
std::chrono::nanoseconds ns(15);
|
||||
ns /= 5;
|
||||
assert(ns.count() == 3);
|
||||
}
|
||||
|
||||
#if TEST_STD_VER > 14
|
||||
static_assert(test_constexpr(), "");
|
||||
#endif
|
||||
}
|
||||
|
@ -16,12 +16,30 @@
|
||||
#include <chrono>
|
||||
#include <cassert>
|
||||
|
||||
#include "test_macros.h"
|
||||
|
||||
#if TEST_STD_VER > 14
|
||||
constexpr bool test_constexpr()
|
||||
{
|
||||
std::chrono::microseconds us1(11);
|
||||
std::chrono::microseconds us2(3);
|
||||
us1 %= us2;
|
||||
return us1.count() == 2;
|
||||
}
|
||||
#endif
|
||||
|
||||
int main()
|
||||
{
|
||||
std::chrono::microseconds us(11);
|
||||
{
|
||||
std::chrono::microseconds us1(11);
|
||||
std::chrono::microseconds us2(3);
|
||||
us %= us2;
|
||||
assert(us.count() == 2);
|
||||
us %= std::chrono::milliseconds(3);
|
||||
assert(us.count() == 2);
|
||||
us1 %= us2;
|
||||
assert(us1.count() == 2);
|
||||
us1 %= std::chrono::milliseconds(3);
|
||||
assert(us1.count() == 2);
|
||||
}
|
||||
|
||||
#if TEST_STD_VER > 14
|
||||
static_assert(test_constexpr(), "");
|
||||
#endif
|
||||
}
|
||||
|
@ -16,9 +16,26 @@
|
||||
#include <chrono>
|
||||
#include <cassert>
|
||||
|
||||
#include "test_macros.h"
|
||||
|
||||
#if TEST_STD_VER > 14
|
||||
constexpr bool test_constexpr()
|
||||
{
|
||||
std::chrono::seconds s(11);
|
||||
s %= 3;
|
||||
return s.count() == 2;
|
||||
}
|
||||
#endif
|
||||
|
||||
int main()
|
||||
{
|
||||
{
|
||||
std::chrono::microseconds us(11);
|
||||
us %= 3;
|
||||
assert(us.count() == 2);
|
||||
}
|
||||
|
||||
#if TEST_STD_VER > 14
|
||||
static_assert(test_constexpr(), "");
|
||||
#endif
|
||||
}
|
||||
|
@ -16,9 +16,26 @@
|
||||
#include <chrono>
|
||||
#include <cassert>
|
||||
|
||||
#include "test_macros.h"
|
||||
|
||||
#if TEST_STD_VER > 14
|
||||
constexpr bool test_constexpr()
|
||||
{
|
||||
std::chrono::seconds s(3);
|
||||
s *= 5;
|
||||
return s.count() == 15;
|
||||
}
|
||||
#endif
|
||||
|
||||
int main()
|
||||
{
|
||||
{
|
||||
std::chrono::nanoseconds ns(3);
|
||||
ns *= 5;
|
||||
assert(ns.count() == 15);
|
||||
}
|
||||
|
||||
#if TEST_STD_VER > 14
|
||||
static_assert(test_constexpr(), "");
|
||||
#endif
|
||||
}
|
||||
|
@ -132,7 +132,7 @@
|
||||
<tr><td><a href="http://wg21.link/P0502R0">P0502R0</a></td><td>LWG</td><td>Throwing out of a parallel algorithm terminates - but how?</td><td>Issaquah</td><td></td><td></td></tr>
|
||||
<tr><td><a href="http://wg21.link/P0503R0">P0503R0</a></td><td>LWG</td><td>Correcting library usage of "literal type"</td><td>Issaquah</td><td>Complete</td><td>4.0</td></tr>
|
||||
<tr><td><a href="http://wg21.link/P0504R0">P0504R0</a></td><td>LWG</td><td>Revisiting in-place tag types for any/optional/variant</td><td>Issaquah</td><td>Complete</td><td>4.0</td></tr>
|
||||
<tr><td><a href="http://wg21.link/P0505R0">P0505R0</a></td><td>LWG</td><td>Wording for GB 50 - constexpr for chrono</td><td>Issaquah</td><td></td><td></td></tr>
|
||||
<tr><td><a href="http://wg21.link/P0505R0">P0505R0</a></td><td>LWG</td><td>Wording for GB 50 - constexpr for chrono</td><td>Issaquah</td><td>Complete</td><td>4.0</td></tr>
|
||||
<tr><td><a href="http://wg21.link/P0508R0">P0508R0</a></td><td>LWG</td><td>Wording for GB 58 - structured bindings for node_handles</td><td>Issaquah</td><td></td><td></td></tr>
|
||||
<tr><td><a href="http://wg21.link/P0509R1">P0509R1</a></td><td>LWG</td><td>Updating “Restrictions on exception handling”</td><td>Issaquah</td><td><i>Nothing to do</i></td><td>n/a</td></tr>
|
||||
<tr><td><a href="http://wg21.link/P0510R0">P0510R0</a></td><td>LWG</td><td>Disallowing references, incomplete types, arrays, and empty variants</td><td>Issaquah</td><td>Complete</td><td>4.0</td></tr>
|
||||
|
Loading…
Reference in New Issue
Block a user