Make date.h compatible with g++-4.7

This commit is contained in:
Si Wei How 2019-05-30 15:43:10 +08:00 committed by Howard Hinnant
parent 09d90a8b5e
commit c0e7b4e2f7

View File

@ -70,7 +70,9 @@
#ifdef __GNUC__
# pragma GCC diagnostic push
# 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
<int, std::ratio_multiply<std::ratio<24>, std::chrono::hours::period>>;
<int, std::ratio_multiply<std::ratio<24>, std::chrono::hours::period>::type>;
using weeks = std::chrono::duration
<int, std::ratio_multiply<std::ratio<7>, days::period>>;
<int, std::ratio_multiply<std::ratio<7>, days::period>::type>;
using years = std::chrono::duration
<int, std::ratio_multiply<std::ratio<146097, 400>, days::period>>;
<int, std::ratio_multiply<std::ratio<146097, 400>, days::period>::type>;
using months = std::chrono::duration
<int, std::ratio_divide<years::period, std::ratio<12>>>;
<int, std::ratio_divide<years::period, std::ratio<12>>::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<short>::min();
}
CONSTCD11
inline
year
year::min() NOEXCEPT
{
return year{-32767};
}
CONSTCD11
inline
year
year::max() NOEXCEPT
{
return year{32767};
}
CONSTCD11
inline
bool