From c0e7b4e2f7007f3e62381af3691d8d4952e0b54e Mon Sep 17 00:00:00 2001 From: Si Wei How Date: Thu, 30 May 2019 15:43:10 +0800 Subject: [PATCH] Make date.h compatible with g++-4.7 --- include/date/date.h | 32 +++++++++----------------------- 1 file changed, 9 insertions(+), 23 deletions(-) diff --git a/include/date/date.h b/include/date/date.h index 5188268..14d76f2 100644 --- a/include/date/date.h +++ b/include/date/date.h @@ -70,7 +70,9 @@ #ifdef __GNUC__ # pragma GCC diagnostic push -# pragma GCC diagnostic ignored "-Wpedantic" +# if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR > 7) +# pragma GCC diagnostic ignored "-Wpedantic" +# endif # if __GNUC__ < 5 // GCC 4.9 Bug 61489 Wrong warning with -Wmissing-field-initializers # pragma GCC diagnostic ignored "-Wmissing-field-initializers" @@ -162,16 +164,16 @@ namespace date // durations using days = std::chrono::duration - , std::chrono::hours::period>>; + , std::chrono::hours::period>::type>; using weeks = std::chrono::duration - , days::period>>; + , days::period>::type>; using years = std::chrono::duration - , days::period>>; + , days::period>::type>; using months = std::chrono::duration - >>; + >::type>; // time_point @@ -404,8 +406,8 @@ public: CONSTCD11 explicit operator int() const NOEXCEPT; CONSTCD11 bool ok() const NOEXCEPT; - static CONSTCD11 year min() NOEXCEPT; - static CONSTCD11 year max() NOEXCEPT; + static CONSTCD11 year min() NOEXCEPT { return year{-32767}; } + static CONSTCD11 year max() NOEXCEPT { return year{32767}; } }; CONSTCD11 bool operator==(const year& x, const year& y) NOEXCEPT; @@ -1617,22 +1619,6 @@ year::ok() const NOEXCEPT return y_ != std::numeric_limits::min(); } -CONSTCD11 -inline -year -year::min() NOEXCEPT -{ - return year{-32767}; -} - -CONSTCD11 -inline -year -year::max() NOEXCEPT -{ - return year{32767}; -} - CONSTCD11 inline bool